Skip to content

Commit d255698

Browse files
committed
Use performSync instead
1 parent 978bcbe commit d255698

1 file changed

Lines changed: 8 additions & 10 deletions

File tree

tests/msc4354/sticky_events_test.go

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,7 @@ func TestStickyEventsChunkedInSync(t *testing.T) {
568568

569569
roomID := alice.MustCreateRoom(t, map[string]interface{}{"preset": "public_chat"})
570570
bob.MustJoinRoom(t, roomID, []spec.ServerName{"hs1"})
571-
_, bobSince := bob.MustSync(t, client.SyncReq{})
571+
_, bobSince, _ := performSync(t, bob, false, "", roomID, "")
572572
t.Logf("before any sticky events: since=%s", bobSince)
573573

574574
// This test assumes 3x /sync requests is enough to see all numMsgsToSend.
@@ -593,21 +593,19 @@ func TestStickyEventsChunkedInSync(t *testing.T) {
593593
}
594594

595595
// do a single /sync request on bob
596-
resp, bobSince := bob.MustSync(t, client.SyncReq{Since: bobSince})
596+
resp, bobSince, _ := performSync(t, bob, false, bobSince, roomID, "")
597597
t.Logf("after 1st /sync: since=%s", bobSince)
598598

599-
removeStickyEvents := func(resp gjson.Result) {
599+
removeStickyEvents := func(resp syncResponse) {
600600
// bob should not see all the sticky events.
601601
// This includes timeline events (e.g N-25 sticky events + 25 timeline events is still N sticky events).
602-
sticky := resp.Get("rooms.join." + client.GjsonEscape(roomID) + ".msc4354_sticky.events").Array()
603-
for _, ev := range sticky {
602+
for _, ev := range resp.stickyEvents {
604603
delete(stickyEventIDs, ev.Get("event_id").Str)
605604
}
606-
timeline := resp.Get("rooms.join." + client.GjsonEscape(roomID) + ".timeline.events").Array()
607-
for _, ev := range timeline {
605+
for _, ev := range resp.timelineEvents {
608606
delete(stickyEventIDs, ev.Get("event_id").Str)
609607
}
610-
t.Logf("/sync contained %d sticky events and %d timeline events", len(sticky), len(timeline))
608+
t.Logf("/sync contained %d sticky events and %d timeline events", len(resp.stickyEvents), len(resp.timelineEvents))
611609
}
612610
removeStickyEvents(resp)
613611

@@ -616,10 +614,10 @@ func TestStickyEventsChunkedInSync(t *testing.T) {
616614
ct.Fatalf(t, "sent %d sticky events, first sync contained %d, too many sticky events in one /sync", numMsgsToSend, numMsgsToSend-len(stickyEventIDs))
617615
}
618616

619-
resp, bobSince = bob.MustSync(t, client.SyncReq{Since: bobSince, TimeoutMillis: "0"})
617+
resp, bobSince, _ = performSync(t, bob, false, bobSince, roomID, "")
620618
t.Logf("after 2nd /sync: since=%s", bobSince)
621619
removeStickyEvents(resp)
622-
resp, _ = bob.MustSync(t, client.SyncReq{Since: bobSince, TimeoutMillis: "0"})
620+
resp, bobSince, _ = performSync(t, bob, false, bobSince, roomID, "")
623621
t.Logf("after 3rd /sync: since=%s", bobSince)
624622
removeStickyEvents(resp)
625623
if len(stickyEventIDs) != 0 {

0 commit comments

Comments
 (0)