Skip to content

Commit dabc7c5

Browse files
committed
!revert test changes
1 parent 8fe27ab commit dabc7c5

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

crates/matrix-sdk/tests/integration/event_cache.rs

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -428,12 +428,11 @@ async fn test_reset_while_backpaginating() {
428428
JoinedRoomBuilder::new(room_id)
429429
// Note to self: a timeline must have at least single event to be properly
430430
// serialized.
431-
.add_timeline_event(event_builder.make_sync_message_event_with_id(
431+
.add_timeline_event(event_builder.make_sync_message_event(
432432
user_id!("@a:b.c"),
433-
event_id!("$from_first_sync"),
434433
RoomMessageEventContent::text_plain("heyo"),
435434
))
436-
.set_timeline_prev_batch("first_prev_batch_token".to_owned()),
435+
.set_timeline_prev_batch("first_backpagination".to_owned()),
437436
);
438437
let response_body = sync_builder.build_json_sync_response();
439438

@@ -472,27 +471,25 @@ async fn test_reset_while_backpaginating() {
472471
JoinedRoomBuilder::new(room_id)
473472
// Note to self: a timeline must have at least single event to be properly
474473
// serialized.
475-
.add_timeline_event(event_builder.make_sync_message_event_with_id(
474+
.add_timeline_event(event_builder.make_sync_message_event(
476475
user_id!("@a:b.c"),
477-
event_id!("$from_second_sync"),
478476
RoomMessageEventContent::text_plain("heyo"),
479477
))
480-
.set_timeline_prev_batch("second_prev_batch_token_from_sync".to_owned())
478+
.set_timeline_prev_batch("second_backpagination".to_owned())
481479
.set_timeline_limited(),
482480
);
483481
let sync_response_body = sync_builder.build_json_sync_response();
484482

485483
// 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") ]);
487485
let response_json = json!({
488486
"chunk": chunk,
489487
"start": "t392-516_47314_0_7_1_1_1_11444_1",
490-
"end": "second_prev_batch_token_from_backpagination"
491488
});
492489
Mock::given(method("GET"))
493490
.and(path_regex(r"^/_matrix/client/r0/rooms/.*/messages$"))
494491
.and(header("authorization", "Bearer 1234"))
495-
.and(query_param("from", "first_prev_batch_token"))
492+
.and(query_param("from", "first_backpagination"))
496493
.respond_with(
497494
ResponseTemplate::new(200)
498495
.set_body_json(response_json.clone())
@@ -515,17 +512,16 @@ async fn test_reset_while_backpaginating() {
515512
mock_sync(&server, sync_response_body, None).await;
516513
client.sync_once(Default::default()).await.unwrap();
517514

518-
let outcome = backpagination.await.expect("join failed");
515+
let outcome = backpagination.await.expect("join failed").unwrap();
519516

520517
// Backpagination should be confused, and the operation should result in an
521518
// unknown token.
522-
assert_matches!(outcome, Ok(BackPaginationOutcome::UnknownBackpaginationToken));
519+
assert_matches!(outcome, BackPaginationOutcome::UnknownBackpaginationToken);
523520

524521
// 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!
526522
let second_token = room_event_cache.oldest_backpagination_token(None).await.unwrap().unwrap();
527523
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");
529525
}
530526

531527
#[async_test]

0 commit comments

Comments
 (0)