Skip to content

Commit

Permalink
fix(test): unlock job test fix
Browse files Browse the repository at this point in the history
  • Loading branch information
simllll committed Oct 20, 2020
1 parent b8cc61f commit 6446b64
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions test/job.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ describe('Job', () => {
});

it('clears locks on stop', async () => {
agenda.define('longRunningJob', job => {
agenda.define('longRunningJob', (_job, _cb) => {
// eslint-disable-line no-unused-vars
// Job never finishes
});
Expand All @@ -680,14 +680,16 @@ describe('Job', () => {

await agenda.start();
await delay(jobTimeout);
const jobStarted = await agenda.db.getJobs({ name: 'longRunningJob' });
expect(jobStarted[0].lockedAt).to.not.equal(null);
await agenda.stop();
const job = await agenda.db.getJobs({ name: 'longRunningJob' });
expect(job[0].lockedAt).to.equal(null);
expect(job[0].lockedAt).to.equal(undefined);
});

describe('events', () => {
beforeEach(() => {
agenda.define('jobQueueTest', (job, cb) => {
agenda.define('jobQueueTest', (_job, cb) => {
cb();
});
agenda.define('failBoat', () => {
Expand Down

0 comments on commit 6446b64

Please sign in to comment.