Initial commit: full-stack Bun + Elysia + React template
Elysia.js API with session-based auth (email/password + Google OAuth), role system (USER/ADMIN/SUPER_ADMIN), Prisma + PostgreSQL, React 19 with Mantine UI, TanStack Router, dark theme, and comprehensive test suite (unit, integration, E2E with Lightpanda). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
26
tests/e2e/api-hello.test.ts
Normal file
26
tests/e2e/api-hello.test.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import { test, expect, describe } from 'bun:test'
|
||||
import { createPage } from './browser'
|
||||
|
||||
describe('E2E: Hello API via browser', () => {
|
||||
test('GET /api/hello returns message', async () => {
|
||||
const { page, cleanup } = await createPage()
|
||||
try {
|
||||
const body = await page.getResponseBody('/api/hello')
|
||||
const data = JSON.parse(body)
|
||||
expect(data).toEqual({ message: 'Hello, world!', method: 'GET' })
|
||||
} finally {
|
||||
cleanup()
|
||||
}
|
||||
})
|
||||
|
||||
test('GET /api/hello/:name returns personalized message', async () => {
|
||||
const { page, cleanup } = await createPage()
|
||||
try {
|
||||
const body = await page.getResponseBody('/api/hello/Bun')
|
||||
const data = JSON.parse(body)
|
||||
expect(data).toEqual({ message: 'Hello, Bun!' })
|
||||
} finally {
|
||||
cleanup()
|
||||
}
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user