Skip to content

Commit 7ebb33f

Browse files
committed
add tests for direct instantiation
1 parent 007cafe commit 7ebb33f

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

test/test.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,13 +184,20 @@ describe('Subclass Instantiation', function () {
184184
// eslint-disable-next-line no-new
185185
new createError.NotFound()
186186
})
187+
assert.doesNotThrow(() => {
188+
// eslint-disable-next-line no-new
189+
createError.NotFound()
190+
})
187191
})
188192

189193
it('should allow instantiation of ServerError subclasses', function () {
190194
assert.doesNotThrow(() => {
191195
// eslint-disable-next-line no-new
192196
new createError.InternalServerError()
193197
})
198+
assert.doesNotThrow(() => {
199+
createError.InternalServerError()
200+
})
194201
})
195202
})
196203

@@ -369,6 +376,10 @@ describe('HTTP Errors', function () {
369376
assert.throws(function () {
370377
new createError.HttpError() // eslint-disable-line no-new
371378
}, /cannot construct abstract class/)
379+
380+
assert.throws(function () {
381+
createError.HttpError()
382+
}, /cannot construct abstract class/)
372383
})
373384

374385
it('new createError.NotFound()', function () {

0 commit comments

Comments
 (0)