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:
27
tests/integration/api-hello.test.ts
Normal file
27
tests/integration/api-hello.test.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import { test, expect, describe } from 'bun:test'
|
||||
import { createTestApp } from '../helpers'
|
||||
|
||||
const app = createTestApp()
|
||||
|
||||
describe('Example API routes', () => {
|
||||
test('GET /api/hello returns message', async () => {
|
||||
const res = await app.handle(new Request('http://localhost/api/hello'))
|
||||
expect(res.status).toBe(200)
|
||||
const body = await res.json()
|
||||
expect(body).toEqual({ message: 'Hello, world!', method: 'GET' })
|
||||
})
|
||||
|
||||
test('PUT /api/hello returns message', async () => {
|
||||
const res = await app.handle(new Request('http://localhost/api/hello', { method: 'PUT' }))
|
||||
expect(res.status).toBe(200)
|
||||
const body = await res.json()
|
||||
expect(body).toEqual({ message: 'Hello, world!', method: 'PUT' })
|
||||
})
|
||||
|
||||
test('GET /api/hello/:name returns personalized message', async () => {
|
||||
const res = await app.handle(new Request('http://localhost/api/hello/Bun'))
|
||||
expect(res.status).toBe(200)
|
||||
const body = await res.json()
|
||||
expect(body).toEqual({ message: 'Hello, Bun!' })
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user