Skip to content

Commit

Permalink
Remove typeof property
Browse files Browse the repository at this point in the history
  • Loading branch information
kanongil committed Dec 5, 2023
1 parent 70c0964 commit 60893c0
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 51 deletions.
2 changes: 0 additions & 2 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,6 @@ exports.Boom = class Boom extends Error {
Error.captureStackTrace(this, ctor); // Filter the stack to our external API

this.#apply(data, statusCode, headers);

Object.defineProperty(this, 'typeof', { value: ctor });
}

static [Symbol.hasInstance](instance) {
Expand Down
49 changes: 0 additions & 49 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -972,55 +972,6 @@ describe('Boom', () => {
});
});

describe('error.typeof', () => {

const types = [
'badRequest',
'unauthorized',
'forbidden',
'notFound',
'methodNotAllowed',
'notAcceptable',
'proxyAuthRequired',
'clientTimeout',
'conflict',
'resourceGone',
'lengthRequired',
'preconditionFailed',
'entityTooLarge',
'uriTooLong',
'unsupportedMediaType',
'rangeNotSatisfiable',
'expectationFailed',
'badData',
'preconditionRequired',
'tooManyRequests',
'internal',
'notImplemented',
'badGateway',
'serverUnavailable',
'gatewayTimeout',
'badImplementation'
];

types.forEach((name) => {

it(`matches typeof Boom.${name}`, () => {

const error = Boom[name]();
types.forEach((type) => {

if (type === name) {
expect(error.typeof).to.shallow.equal(Boom[name]);
}
else {
expect(error.typeof).to.not.shallow.equal(Boom[type]);
}
});
});
});
});

describe('reformat()', () => {

it('displays internal server error messages in debug mode', () => {
Expand Down

0 comments on commit 60893c0

Please sign in to comment.