brf/server/tests/auth.test.ts
2025-12-18 07:31:37 +01:00

27 lines
595 B
TypeScript

import { test, type TestContext } from 'node:test'
import Server from '../server.ts'
test('Auth', async (t: TestContext) => {
const server = await Server()
await t.test('login', async (t: TestContext) => {
const res = await server.inject({
method: 'POST',
path: '/auth/login',
payload: {
email: 'linus.miller@bitmill.io',
password: 'rasmus',
},
})
const sessionCookie = res.cookies.find((cookie) => cookie.name === 'sessionId')
t.assert.ok(sessionCookie)
t.assert.equal(res.statusCode, 200)
await server.close()
})
})