Skip to content

Commit

Permalink
Tests for restore:true error fix (#2)
Browse files Browse the repository at this point in the history
Tests for WeeverApps#1
  • Loading branch information
ggutenberg committed Apr 2, 2019
1 parent ef5cb31 commit 9443e8d
Show file tree
Hide file tree
Showing 3 changed files with 148 additions and 8 deletions.
132 changes: 125 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -78,6 +78,7 @@
"grunt-mocha-test": "^0.13.3",
"jshint-stylish": "^2.2.1",
"mocha": "^5.2.0",
"moment": "^2.23.0"
"moment": "^2.23.0",
"sinon": "7.3.1"
}
}
21 changes: 21 additions & 0 deletions test/instatiation.spec.js
Expand Up @@ -3,6 +3,7 @@
//dependencies
var expect = require('chai').expect;
var path = require('path');
var sinon = require('sinon');
var kue = require(path.join(__dirname, '..', 'index'));
var Queue;

Expand Down Expand Up @@ -71,3 +72,23 @@ describe('Queue Job Scheduler & Listener', function () {
});

});

describe('Queue Job Scheduler & Listener Errors', function () {
var _getAllJobDataStub;
function fakeGetAllJobData (callback) {
callback(new Error('Some error occurred'));
}
beforeEach(function (done) {
_getAllJobDataStub = sinon.stub(kue.prototype, '_getAllJobData').callsFake(fakeGetAllJobData);
done();
});
afterEach(function (done) {
_getAllJobDataStub.restore();
done();
});
it('should not die with `TypeError: Cannot read property \'emit\' of undefined` when `restore:true`', function (done) {
Queue = kue.createQueue({restore: true});
expect(_getAllJobDataStub.called).to.be.true;
done();
});
});

0 comments on commit 9443e8d

Please sign in to comment.