27 lines
595 B
TypeScript
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()
|
|
})
|
|
})
|