Skip to content

Commit

Permalink
Add tests for "name" property
Browse files Browse the repository at this point in the history
  • Loading branch information
kanongil committed Dec 7, 2023
1 parent 9b9ed18 commit 86f2bf1
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,27 @@ describe('Boom', () => {
expect(JSON.stringify(err)).to.equal('{"data":null,"output":{"statusCode":400,"payload":{"statusCode":400,"error":"Bad Request","message":"oops"},"headers":{}}}');
});

it('instances has .name "Boom"', () => {

class SubBoom extends Boom.Boom {}

expect(new Boom.Boom().name).to.equal('Boom');
expect(new SubBoom().name).to.equal('Boom');
});

it('instances .name can be changed', () => {

class SubBoom extends Boom.Boom {
name = 'BadaBoom';
}

const err = new Boom.Boom();
err.name = 'MyBoom';

expect(err.name).to.equal('MyBoom');
expect(new SubBoom().name).to.equal('BadaBoom');
});

it('handles missing message', () => {

const err = new Boom.Boom();
Expand Down

0 comments on commit 86f2bf1

Please sign in to comment.