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>
28 lines
824 B
TypeScript
28 lines
824 B
TypeScript
import { test, expect, describe } from 'bun:test'
|
|
import { createPage, APP_HOST } from './browser'
|
|
|
|
describe('E2E: Google OAuth redirect', () => {
|
|
test('navigating to /api/auth/google ends up at Google', async () => {
|
|
const { page, cleanup } = await createPage()
|
|
try {
|
|
await page.goto(APP_HOST + '/api/auth/google')
|
|
const url = await page.url()
|
|
expect(url).toContain('accounts.google.com')
|
|
} finally {
|
|
cleanup()
|
|
}
|
|
})
|
|
|
|
test('callback without code redirects to login error', async () => {
|
|
const { page, cleanup } = await createPage()
|
|
try {
|
|
await page.goto(APP_HOST + '/api/auth/callback/google')
|
|
const url = await page.url()
|
|
expect(url).toContain('/login')
|
|
expect(url).toContain('error=google_failed')
|
|
} finally {
|
|
cleanup()
|
|
}
|
|
})
|
|
})
|