Skip to content

Commit 49ef118

Browse files
committed
improve test
1 parent 734d06c commit 49ef118

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

test/index.test.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,19 +223,21 @@ test('Create an error with last argument null', (t) => {
223223
})
224224

225225
test('check if instanceof works', (t) => {
226-
t.plan(5)
226+
t.plan(7)
227227

228228
const NewError = createError('CODE', 'Not available')
229229
const err = NewError()
230230

231-
const NewFastifySyntaxError = createError('CODE', 'Not available', 500, SyntaxError)
232-
const syntaxErr = NewFastifySyntaxError()
231+
const FastifySyntaxError = createError('CODE', 'Not available', 500, SyntaxError)
232+
const syntaxErr = new FastifySyntaxError()
233233

234234
t.assert.ok(err instanceof Error)
235235
t.assert.ok(err instanceof FastifyError)
236+
t.assert.ok(err instanceof SyntaxError === false)
236237
t.assert.ok(new Error() instanceof FastifyError === false)
237238
t.assert.ok(syntaxErr instanceof SyntaxError)
238239
t.assert.ok(syntaxErr instanceof FastifyError)
240+
t.assert.ok(syntaxErr instanceof FastifySyntaxError)
239241
})
240242

241243
test('check if FastifyError is instantiable', (t) => {

0 commit comments

Comments
 (0)