Closed jmarucha closed 5 years ago
@jmarucha what is printed?
This is from the tests, it should reject the promise with the error you throw
it('query#reject', (done) => {
tracker.on('query', (query) => {
query.reject('i threw up');
});
db.select('field').from('test-table').catch((error) => {
expect(error.message).to.be.a('string');
expect(error.message.indexOf('i threw up')).to.not.equal(-1);
done();
});
});
I'm writing unit tests to handle possible DB errors:
Later in code when I print
error.message
of the error propagating it iswhich is
query.sql + ' - ' + error.message
of what I would expect. This makes it impossible to test any error handling.Using mock-knex 0.4.2, knex 0.14.4 and bookshelf 0.13.3