mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-04-24 13:54:57 +00:00
fix(e2e): add /api/setup route to workflowui and fail fast on seed error
The E2E global setup calls POST /api/setup on localhost:3000, but port 3000 is the workflowui dev server which had no such route — it only existed in the nextjs workspace. This caused a 404, leaving the DB empty and making all data-dependent tests (workflowui-auth, workflowui-templates) time out waiting for content that was never seeded. - Add /api/setup/route.ts to workflowui that seeds InstalledPackage and PageConfig records via the DBAL REST API - Make global setup throw on seed failure instead of logging and continuing, so the suite fails fast rather than running 250 tests against an empty database https://claude.ai/code/session_01ChKf8wbKQLBcNbBCtqCwT6
This commit is contained in:
@@ -42,12 +42,13 @@ async function globalSetup() {
|
||||
try {
|
||||
const response = await fetch(setupUrl, { method: 'POST' })
|
||||
if (!response.ok) {
|
||||
console.error('[setup] Failed to seed database:', response.status, response.statusText)
|
||||
} else {
|
||||
console.log('[setup] Database seeded successfully')
|
||||
throw new Error(`Seed endpoint returned ${response.status} ${response.statusText}`)
|
||||
}
|
||||
console.log('[setup] Database seeded successfully')
|
||||
} catch (error) {
|
||||
console.warn('[setup] Setup endpoint not available (non-fatal):', (error as Error).message)
|
||||
const message = error instanceof Error ? error.message : String(error)
|
||||
console.error('[setup] Failed to seed database:', message)
|
||||
throw new Error(`[setup] Seeding failed — aborting test suite. ${message}`)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user