Skip to content

Commit 556494b

Browse files
authored
Attempt deflaking of queueToDevice test (#4936)
1 parent bf3b4e8 commit 556494b

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

spec/unit/queueToDevice.spec.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,13 +126,15 @@ describe.each([[StoreType.Memory], [StoreType.IndexedDB]])("queueToDevice (%s st
126126
eventType: "org.example.foo",
127127
batch: [FAKE_MSG],
128128
});
129-
expect(await httpBackend.flush(undefined, 1, 1)).toEqual(1);
129+
// flush the 500 response
130+
expect(await httpBackend.flush("/sendToDevice/org.example.foo/", 1, 20)).toEqual(1);
130131
await flushPromises();
131132

132133
client.retryImmediately();
133134

135+
// flush the 200 response
134136
// longer timeout here to try & avoid flakiness
135-
expect(await httpBackend.flush(undefined, 1, 3000)).toEqual(1);
137+
expect(await httpBackend.flush("/sendToDevice/org.example.foo/", 1, 3000)).toEqual(1);
136138
});
137139

138140
it("retries on when client is started", async function () {
@@ -150,13 +152,15 @@ describe.each([[StoreType.Memory], [StoreType.IndexedDB]])("queueToDevice (%s st
150152
eventType: "org.example.foo",
151153
batch: [FAKE_MSG],
152154
});
153-
expect(await httpBackend.flush(undefined, 1, 1)).toEqual(1);
155+
// flush the 500 response
156+
expect(await httpBackend.flush("/sendToDevice/org.example.foo/", 1, 20)).toEqual(1);
154157
await flushPromises();
155158

156159
client.stopClient();
157160
await Promise.all([client.startClient(), httpBackend.flush("/_matrix/client/versions", 1, 20)]);
158161

159-
expect(await httpBackend.flush(undefined, 1, 20)).toEqual(1);
162+
// flush the 200 response
163+
expect(await httpBackend.flush("/sendToDevice/org.example.foo/", 1, 20)).toEqual(1);
160164
});
161165

162166
it("retries when a message is retried", async function () {

0 commit comments

Comments
 (0)