Skip to content

Commit

Permalink
awolden#105 added test case for modify error toggle
Browse files Browse the repository at this point in the history
  • Loading branch information
JuniusBBD committed Nov 1, 2018
1 parent 8b4d3f5 commit 5984c34
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/Brakes.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ const defaultOptions = {
modifyError: true
};

const modifyError = function modifyError() {
throw { message: 'Not found' , status: 404 };
}

const noop = function noop(foo, err, cb) {
if (typeof err === 'function') {
cb = err;
Expand Down Expand Up @@ -114,6 +118,14 @@ describe('Brakes Class', () => {
expect(err.message).to.equal('[Breaker: defaultBrake] err');
});
});
it('Should not prefix error messages', () => {
brake = new Brakes(modifyError, {
modifyError: false,
});
return brake.exec(null).then(null, err => {
expect(err.message).to.equal('Not found');
});
});

it('Should accept a promise', () => {
brake = new Brakes(nopr);
Expand Down

0 comments on commit 5984c34

Please sign in to comment.