Skip to content

Commit

Permalink
chore: fix flaky test
Browse files Browse the repository at this point in the history
  • Loading branch information
roggervalf committed Dec 19, 2024
1 parent f0155f3 commit cf8f272
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions tests/test_events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -791,9 +791,15 @@ describe('events', function () {
);

let deduplicatedCounter = 0;
queueEvents.on('deduplicated', ({ jobId }) => {
deduplicatedCounter++;
const deduplication = new Promise<void>(resolve => {
queueEvents.on('deduplicated', () => {
deduplicatedCounter++;
if (deduplicatedCounter == 2) {
resolve();
}
});
});

await job.remove();

await queue.add(
Expand All @@ -814,6 +820,7 @@ describe('events', function () {
{ deduplication: { id: 'a1' } },
);
await secondJob.remove();
await deduplication;

expect(deduplicatedCounter).to.be.equal(2);
});
Expand Down

0 comments on commit cf8f272

Please sign in to comment.