Skip to content

Commit

Permalink
test: remove debounceKey after job is removed in extended mode (#2722)
Browse files Browse the repository at this point in the history
  • Loading branch information
roggervalf authored Aug 23, 2024
1 parent a457a54 commit ae0f3c3
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions tests/test_events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,37 @@ describe('events', function () {
expect(secondJob.id).to.be.equal('4');
await worker.close();
});

describe('when removing debounced job', function () {
it('removes debounce key', async function () {
const testName = 'test';

const job = await queue.add(
testName,
{ foo: 'bar' },
{ debounce: { id: 'a1' } },
);

let debouncedCounter = 0;
queueEvents.on('debounced', ({ jobId }) => {
debouncedCounter++;
});
await job.remove();

await queue.add(testName, { foo: 'bar' }, { debounce: { id: 'a1' } });

await queue.add(testName, { foo: 'bar' }, { debounce: { id: 'a1' } });
await delay(100);
const secondJob = await queue.add(
testName,
{ foo: 'bar' },
{ debounce: { id: 'a1' } },
);
await secondJob.remove();

expect(debouncedCounter).to.be.equal(2);
});
});
});
});

Expand Down

0 comments on commit ae0f3c3

Please sign in to comment.