Skip to content

Commit

Permalink
test(types): expect error when required secret option missing
Browse files Browse the repository at this point in the history
  • Loading branch information
Fdawgs committed Dec 12, 2024
1 parent 8c575a6 commit 31f4063
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions types/types.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ expectType<SessionStore>(plugin.MemoryStore)
const secret = 'ABCDEFGHIJKLNMOPQRSTUVWXYZ012345'

const app: FastifyInstance = fastify()
app.register(plugin)
app.register(plugin, { secret: 'DizIzSecret' })
app.register(plugin, { secret: 'DizIzSecret', rolling: true })
app.register(plugin, {
Expand Down Expand Up @@ -82,6 +81,7 @@ app.register(plugin, {
idGenerator: (request) => `${request === undefined ? 'null' : request.ip}-${Date.now()}`
})

expectError(app.register(plugin))
expectError(app.register(plugin, {}))

expectError(app.decryptSession<string>('sessionId', {}, () => ({})))
Expand Down Expand Up @@ -141,7 +141,7 @@ const customSigner = {
app.register(plugin, { secret: customSigner })

const app2 = fastify()
app2.register(fastifySession)
app2.register(fastifySession, { secret: 'DizIzSecret' })

app2.get('/', async function (request) {
expectAssignable<string | undefined>(request.session.get('foo'))
Expand Down

0 comments on commit 31f4063

Please sign in to comment.