@@ -23,7 +23,7 @@ extension Tag {
23
23
@Tag static var messageOrder : Self
24
24
@Tag static var answerMode : Self
25
25
@Tag static var quoteMode : Self
26
- @Tag static var positionInUserGroup : Self
26
+ @Tag static var positionInUserGroupAndMessagesSection : Self
27
27
@Tag static var positionInCommentsGroup : Self
28
28
}
29
29
@@ -221,7 +221,8 @@ struct WrappingMessagesTest {
221
221
}
222
222
223
223
@Test (
224
- " Single message has single position in user group " , . tags( . positionInUserGroup) ,
224
+ " Single message has single position in user group " ,
225
+ . tags( . positionInUserGroupAndMessagesSection) ,
225
226
arguments: ChatType . allCases, ReplyMode . allCases)
226
227
func singleMessageHasSinglePositionInUserGroup( for chatType: ChatType , and replyMode: ReplyMode )
227
228
async throws
@@ -235,11 +236,13 @@ struct WrappingMessagesTest {
235
236
#expect( sections. first? . rows. first? . id == singleMessage. id)
236
237
237
238
#expect( sections. first? . rows. first? . positionInUserGroup == . single)
239
+ #expect( sections. first? . rows. first? . positionInMessagesSection == . single)
238
240
}
239
241
240
242
@Test (
241
243
" Multiple messages from single user have top, middle and bottom positions in user group " ,
242
- . tags( . positionInUserGroup) , arguments: ChatType . allCases, ReplyMode . allCases)
244
+ . tags( . positionInUserGroupAndMessagesSection) , arguments: ChatType . allCases,
245
+ ReplyMode . allCases)
243
246
func multipleMessagesFromSingleUserHaveCorrectUserGroupPositions(
244
247
for chatType: ChatType , and replyMode: ReplyMode
245
248
) async throws {
@@ -262,18 +265,29 @@ struct WrappingMessagesTest {
262
265
switch chatType {
263
266
case . comments:
264
267
#expect( sections. first? . rows [ 0 ] . positionInUserGroup == . first)
268
+ #expect( sections. first? . rows [ 0 ] . positionInMessagesSection == . first)
269
+
265
270
#expect( sections. first? . rows [ 1 ] . positionInUserGroup == . middle)
271
+ #expect( sections. first? . rows [ 1 ] . positionInMessagesSection == . middle)
272
+
266
273
#expect( sections. first? . rows [ 2 ] . positionInUserGroup == . last)
274
+ #expect( sections. first? . rows [ 2 ] . positionInMessagesSection == . last)
267
275
case . conversation:
268
276
#expect( sections. first? . rows [ 2 ] . positionInUserGroup == . first)
277
+ #expect( sections. first? . rows [ 2 ] . positionInMessagesSection == . first)
278
+
269
279
#expect( sections. first? . rows [ 1 ] . positionInUserGroup == . middle)
280
+ #expect( sections. first? . rows [ 1 ] . positionInMessagesSection == . middle)
281
+
270
282
#expect( sections. first? . rows [ 0 ] . positionInUserGroup == . last)
283
+ #expect( sections. first? . rows [ 0 ] . positionInMessagesSection == . last)
271
284
}
272
285
}
273
286
274
287
@Test (
275
288
" Message from another user, in between many messages by another, splits the user group " ,
276
- . tags( . positionInUserGroup) , arguments: ChatType . allCases, ReplyMode . allCases)
289
+ . tags( . positionInUserGroupAndMessagesSection) , arguments: ChatType . allCases,
290
+ ReplyMode . allCases)
277
291
func messageFromAnotherUserSplitsUserGroup( for chatType: ChatType , and replyMode: ReplyMode )
278
292
async throws
279
293
{
@@ -297,22 +311,41 @@ struct WrappingMessagesTest {
297
311
switch chatType {
298
312
case . comments:
299
313
#expect( sections. first? . rows [ 0 ] . positionInUserGroup == . first)
314
+ #expect( sections. first? . rows [ 0 ] . positionInMessagesSection == . first)
315
+
300
316
#expect( sections. first? . rows [ 1 ] . positionInUserGroup == . last)
317
+ #expect( sections. first? . rows [ 1 ] . positionInMessagesSection == . middle)
318
+
301
319
#expect( sections. first? . rows [ 2 ] . positionInUserGroup == . single)
320
+ #expect( sections. first? . rows [ 2 ] . positionInMessagesSection == . middle)
321
+
302
322
#expect( sections. first? . rows [ 3 ] . positionInUserGroup == . first)
323
+ #expect( sections. first? . rows [ 3 ] . positionInMessagesSection == . middle)
324
+
303
325
#expect( sections. first? . rows [ 4 ] . positionInUserGroup == . last)
326
+ #expect( sections. first? . rows [ 4 ] . positionInMessagesSection == . last)
304
327
case . conversation:
305
328
#expect( sections. first? . rows [ 4 ] . positionInUserGroup == . first)
329
+ #expect( sections. first? . rows [ 4 ] . positionInMessagesSection == . first)
330
+
306
331
#expect( sections. first? . rows [ 3 ] . positionInUserGroup == . last)
332
+ #expect( sections. first? . rows [ 3 ] . positionInMessagesSection == . middle)
333
+
307
334
#expect( sections. first? . rows [ 2 ] . positionInUserGroup == . single)
335
+ #expect( sections. first? . rows [ 2 ] . positionInMessagesSection == . middle)
336
+
308
337
#expect( sections. first? . rows [ 1 ] . positionInUserGroup == . first)
338
+ #expect( sections. first? . rows [ 1 ] . positionInMessagesSection == . middle)
339
+
309
340
#expect( sections. first? . rows [ 0 ] . positionInUserGroup == . last)
341
+ #expect( sections. first? . rows [ 0 ] . positionInMessagesSection == . last)
310
342
}
311
343
}
312
344
313
345
@Test (
314
346
" Messages from the same user on different days should not be in the same user group " ,
315
- . tags( . positionInUserGroup) , arguments: ChatType . allCases, ReplyMode . allCases)
347
+ . tags( . positionInUserGroupAndMessagesSection) , arguments: ChatType . allCases,
348
+ ReplyMode . allCases)
316
349
func messagesOnDifferentDaysShouldBeInDifferentUserGroups(
317
350
for chatType: ChatType , and replyMode: ReplyMode
318
351
) async throws {
@@ -329,7 +362,10 @@ struct WrappingMessagesTest {
329
362
#expect( sections [ 0 ] . rows. first? . id == message1. id)
330
363
331
364
#expect( sections [ 1 ] . rows. first? . positionInUserGroup == . single)
365
+ #expect( sections [ 1 ] . rows. first? . positionInMessagesSection == . single)
366
+
332
367
#expect( sections [ 0 ] . rows. first? . positionInUserGroup == . single)
368
+ #expect( sections [ 0 ] . rows. first? . positionInMessagesSection == . single)
333
369
}
334
370
335
371
@Test (
0 commit comments