install vitest #3

This commit is contained in:
Michi 2025-11-02 20:20:17 +01:00
parent 1729766d06
commit 43580e1036
10 changed files with 2199 additions and 119 deletions

41
api/tests/index.test.ts Normal file
View file

@ -0,0 +1,41 @@
import { env } from 'cloudflare:test'
import { app } from '../src/index'
// describe('Example', () => {
// it('Should return 200 response', async () => {
// const res = await app.request('/hello', {}, env)
// expect(res.status).toBe(200)
// expect(await res.json()).toEqual({
// hello: 'world',
// var: 'my variable',
// })
// })
// })
describe('Authentication', () => {
it('Should return 200 response', async () => {
const res = await app.request('/themepark/list', {
headers: {
Cookie: `authjs.session-token=${env.SESSION_TOKEN}`
}
}, env)
expect(res.status).toBe(200)
// expect(await res.json()).toEqual({
// hello: 'world',
// var: 'my variable',
// })
})
})
// describe('Example', () => {
// it('Should return 200 response', async () => {
// const res = await app.request('/protected', {}, env)
// expect(res.status).toBe(200)
// })
// })