Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
MoSheikh committed Apr 23, 2024
1 parent 0f0cdab commit 05c1e10
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion types/index.test-d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expectType, expectAssignable, expectError, expectNotAssignable } from 'tsd'
import fastify from 'fastify'
import fastifySensible, { SensibleOptions, httpErrors } from '..'
import fastifySensible, { SensibleOptions, httpErrors, HttpError } from '..'

const app = fastify()

Expand Down Expand Up @@ -60,6 +60,14 @@ app.get('/', (req, reply) => {
expectAssignable<Error>(app.httpErrors.createError(405, 'Method Not Allowed'))
})

app.get("/", (req, reply) => {
expectAssignable<HttpError>(
app.httpErrors.createError(405, "Method Not Allowed"),
);
expectAssignable<HttpError>(app.httpErrors.badRequest());
});


app.get('/', async (req, reply) => {
expectAssignable<Error>(app.httpErrors.badRequest())
expectAssignable<Error>(app.httpErrors.unauthorized())
Expand Down

0 comments on commit 05c1e10

Please sign in to comment.