Skip to content

Commit 8b3e295

Browse files
zecakehpoljar
authored andcommitted
refactor(test): Use EventBuilder::into_raw_timeline rather than into_event
We need the full event so its better to build it an cast it to a sync event than the opposite. Signed-off-by: Kévin Commaille <[email protected]>
1 parent 1e568ef commit 8b3e295

File tree

1 file changed

+5
-8
lines changed
  • crates/matrix-sdk/tests/integration/event_cache

1 file changed

+5
-8
lines changed

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

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -361,28 +361,28 @@ async fn test_deduplication() {
361361

362362
let room_id = room_id!("!omelette:fromage.fr");
363363

364-
let f = EventFactory::new().sender(*ALICE);
364+
let f = EventFactory::new().room(room_id).sender(*ALICE);
365365

366366
let thread_root = event_id!("$thread_root");
367367
let first_reply_event_id = event_id!("$first_reply");
368368
let first_reply = f
369369
.text_msg("hey there")
370370
.in_thread(thread_root, thread_root)
371371
.event_id(first_reply_event_id)
372-
.into_event();
372+
.into_raw_timeline();
373373
let second_reply_event_id = event_id!("$second_reply");
374374
let second_reply = f
375375
.text_msg("hoy!")
376376
.in_thread(thread_root, first_reply_event_id)
377377
.event_id(second_reply_event_id)
378-
.into_event();
378+
.into_raw_timeline();
379379

380380
// Given a room with a thread, that has two replies.
381381
let room = server
382382
.sync_room(
383383
&client,
384384
JoinedRoomBuilder::new(room_id)
385-
.add_timeline_bulk(vec![first_reply.raw().clone(), second_reply.raw().clone()]),
385+
.add_timeline_bulk(vec![first_reply.clone().cast(), second_reply.clone().cast()]),
386386
)
387387
.await;
388388

@@ -422,10 +422,7 @@ async fn test_deduplication() {
422422
.mock_room_relations()
423423
.match_target_event(thread_root.to_owned())
424424
.ok(RoomRelationsResponseTemplate::default()
425-
.events(vec![
426-
first_reply.raw().cast_ref().clone(),
427-
second_reply.raw().cast_ref().clone(),
428-
])
425+
.events(vec![first_reply, second_reply])
429426
.next_batch("next_batch"))
430427
.mock_once()
431428
.mount()

0 commit comments

Comments
 (0)