@@ -428,12 +428,11 @@ async fn test_reset_while_backpaginating() {
428
428
JoinedRoomBuilder :: new ( room_id)
429
429
// Note to self: a timeline must have at least single event to be properly
430
430
// serialized.
431
- . add_timeline_event ( event_builder. make_sync_message_event_with_id (
431
+ . add_timeline_event ( event_builder. make_sync_message_event (
432
432
user_id ! ( "@a:b.c" ) ,
433
- event_id ! ( "$from_first_sync" ) ,
434
433
RoomMessageEventContent :: text_plain ( "heyo" ) ,
435
434
) )
436
- . set_timeline_prev_batch ( "first_prev_batch_token " . to_owned ( ) ) ,
435
+ . set_timeline_prev_batch ( "first_backpagination " . to_owned ( ) ) ,
437
436
) ;
438
437
let response_body = sync_builder. build_json_sync_response ( ) ;
439
438
@@ -472,27 +471,25 @@ async fn test_reset_while_backpaginating() {
472
471
JoinedRoomBuilder :: new ( room_id)
473
472
// Note to self: a timeline must have at least single event to be properly
474
473
// serialized.
475
- . add_timeline_event ( event_builder. make_sync_message_event_with_id (
474
+ . add_timeline_event ( event_builder. make_sync_message_event (
476
475
user_id ! ( "@a:b.c" ) ,
477
- event_id ! ( "$from_second_sync" ) ,
478
476
RoomMessageEventContent :: text_plain ( "heyo" ) ,
479
477
) )
480
- . set_timeline_prev_batch ( "second_prev_batch_token_from_sync " . to_owned ( ) )
478
+ . set_timeline_prev_batch ( "second_backpagination " . to_owned ( ) )
481
479
. set_timeline_limited ( ) ,
482
480
) ;
483
481
let sync_response_body = sync_builder. build_json_sync_response ( ) ;
484
482
485
483
// First back-pagination request:
486
- let chunk = non_sync_events ! ( event_builder, [ ( room_id, "$from_backpagination " : "lalala" ) ] ) ;
484
+ let chunk = non_sync_events ! ( event_builder, [ ( room_id, "$2 " : "lalala" ) ] ) ;
487
485
let response_json = json ! ( {
488
486
"chunk" : chunk,
489
487
"start" : "t392-516_47314_0_7_1_1_1_11444_1" ,
490
- "end" : "second_prev_batch_token_from_backpagination"
491
488
} ) ;
492
489
Mock :: given ( method ( "GET" ) )
493
490
. and ( path_regex ( r"^/_matrix/client/r0/rooms/.*/messages$" ) )
494
491
. and ( header ( "authorization" , "Bearer 1234" ) )
495
- . and ( query_param ( "from" , "first_prev_batch_token " ) )
492
+ . and ( query_param ( "from" , "first_backpagination " ) )
496
493
. respond_with (
497
494
ResponseTemplate :: new ( 200 )
498
495
. set_body_json ( response_json. clone ( ) )
@@ -515,17 +512,16 @@ async fn test_reset_while_backpaginating() {
515
512
mock_sync ( & server, sync_response_body, None ) . await ;
516
513
client. sync_once ( Default :: default ( ) ) . await . unwrap ( ) ;
517
514
518
- let outcome = backpagination. await . expect ( "join failed" ) ;
515
+ let outcome = backpagination. await . expect ( "join failed" ) . unwrap ( ) ;
519
516
520
517
// Backpagination should be confused, and the operation should result in an
521
518
// unknown token.
522
- assert_matches ! ( outcome, Ok ( BackPaginationOutcome :: UnknownBackpaginationToken ) ) ;
519
+ assert_matches ! ( outcome, BackPaginationOutcome :: UnknownBackpaginationToken ) ;
523
520
524
521
// Now if we retrieve the earliest token, it's not the one we had before.
525
- // Even better, it's the one from the sync, NOT from the backpagination!
526
522
let second_token = room_event_cache. oldest_backpagination_token ( None ) . await . unwrap ( ) . unwrap ( ) ;
527
523
assert ! ( first_token. unwrap( ) != second_token) ;
528
- assert_eq ! ( second_token. 0 , "second_prev_batch_token_from_sync " ) ;
524
+ assert_eq ! ( second_token. 0 , "second_backpagination " ) ;
529
525
}
530
526
531
527
#[ async_test]
0 commit comments