add test for missing index result

This commit is contained in:
2016-05-13 14:59:05 -07:00
parent 868c808db7
commit 300449bfb0

View File

@@ -165,6 +165,24 @@ describe('Worker class', function () {
.then(() => { done(); }) .then(() => { done(); })
.catch(() => done(new Error('should not reject'))); .catch(() => done(new Error('should not reject')));
}); });
it('should return an empty array on missing index', function (done) {
searchStub = sinon.stub(mockQueue.client, 'search', () => Promise.reject({
status: 404
}));
worker = new Worker(mockQueue, 'test', noop);
worker._getPendingJobs()
.then((res) => {
try {
expect(res).to.be.an(Array);
expect(res).to.have.length(0);
done();
} catch (e) {
done(e);
}
})
.catch(() => done(new Error('should not reject')));
});
}); });
describe('query parameters', function () { describe('query parameters', function () {