Skip to content

Commit 4de8cf2

Browse files
committed
Update tests to the new requirements
1 parent 4210090 commit 4de8cf2

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

spec/unit/scheduler.spec.ts

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ describe("MatrixScheduler", function () {
112112
expect(procCount).toEqual(2);
113113
});
114114

115-
it("should give up if the retryFn on failure returns -1 and try the next event", async function () {
115+
it("should give up if the retryFn on failure returns -1", async function () {
116116
// Queue A & B.
117117
// Reject A and return -1 on retry.
118118
// Expect B to be tried next and the promise for A to be rejected.
@@ -139,19 +139,15 @@ describe("MatrixScheduler", function () {
139139
return new Promise<Record<string, boolean>>(() => {});
140140
});
141141

142-
const globalA = scheduler.queueEvent(eventA);
143-
scheduler.queueEvent(eventB);
142+
const queuedA = scheduler.queueEvent(eventA);
143+
const queuedB = scheduler.queueEvent(eventB);
144+
await Promise.resolve();
145+
deferA.reject(new Error("Testerror"));
144146
// as queueing doesn't start processing synchronously anymore (see commit bbdb5ac)
145147
// wait just long enough before it does
146-
await Promise.resolve();
148+
await expect(queuedA).rejects.toThrow("Testerror");
149+
await expect(queuedB).rejects.toThrow("Testerror");
147150
expect(procCount).toEqual(1);
148-
deferA.reject({});
149-
try {
150-
await globalA;
151-
} catch (err) {
152-
await Promise.resolve();
153-
expect(procCount).toEqual(2);
154-
}
155151
});
156152

157153
it("should treat each queue separately", function (done) {

0 commit comments

Comments
 (0)