Skip to content

Commit bd93a9a

Browse files
committed
test: remvoe use of add_initial_events in test_add_initial_events
And make it a smoke test that the event cache correctly gets events it retrieves from sync.
1 parent 5cde4a6 commit bd93a9a

File tree

1 file changed

+1
-27
lines changed

1 file changed

+1
-27
lines changed

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

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ async fn test_must_explicitly_subscribe() {
6060
}
6161

6262
#[async_test]
63-
async fn test_add_initial_events() {
63+
async fn test_event_cache_receives_events() {
6464
let (client, server) = logged_in_client_with_server().await;
6565

6666
// Immediately subscribe the event cache to sync updates.
@@ -116,32 +116,6 @@ async fn test_add_initial_events() {
116116
assert_eq!(events.len(), 1);
117117
assert_event_matches_msg(&events[0], "bonjour monde");
118118

119-
// And when I later add initial events to this room,
120-
121-
// XXX: when we get rid of `add_initial_events`, we can keep this test as a
122-
// smoke test for the event cache.
123-
client
124-
.event_cache()
125-
.add_initial_events(room_id, vec![ev_factory.text_msg("new choice!").into_sync()], None)
126-
.await
127-
.unwrap();
128-
129-
// Then I receive an update that the room has been cleared,
130-
let update = timeout(Duration::from_secs(2), subscriber.recv())
131-
.await
132-
.expect("timeout after receiving a sync update")
133-
.expect("should've received a room event cache update");
134-
assert_let!(RoomEventCacheUpdate::Clear = update);
135-
136-
// Before receiving the "initial" event.
137-
let update = timeout(Duration::from_secs(2), subscriber.recv())
138-
.await
139-
.expect("timeout after receiving a sync update")
140-
.expect("should've received a room event cache update");
141-
assert_let!(RoomEventCacheUpdate::AddTimelineEvents { events, .. } = update);
142-
assert_eq!(events.len(), 1);
143-
assert_event_matches_msg(&events[0], "new choice!");
144-
145119
// That's all, folks!
146120
assert!(subscriber.is_empty());
147121
}

0 commit comments

Comments
 (0)