Skip to content

Commit

Permalink
added failure subscription test
Browse files Browse the repository at this point in the history
  • Loading branch information
timgit committed Apr 27, 2017
1 parent ce4bc7d commit 41e71e1
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test/failureTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,26 @@ describe('error', function(){
});

});

it('should subscribe to a job failure', function(finished){

this.timeout(3000);

const jobName = 'subscribe-fail';
let jobId;

boss.onFail(jobName, job => {
assert.strictEqual(jobId, job.data.request.id);
finished();
});

boss.publish(jobName)
.then(id => jobId = id)
.then(() => boss.fetch(jobName))
.then(job => boss.fail(job.id));

});

});


Expand Down

0 comments on commit 41e71e1

Please sign in to comment.