- pnpm workspace: apps/{web,server}, packages/{contracts,db,domain,adapters,tasks,agent,testkit}
- server: Hono + zod-openapi, API Key auth with scopes, redacting pino logger, SSE event bus with replay, worker heartbeat
- db: Kysely + pg, file migrator, 0001_init (settings/api_key/audit_event/outbox_event)
- web: React Router 7 SPA console shell with 12 workspace placeholders, uhd_web tokens/ui/guard scripts
- docs: ADR-001 (Node over Deno), dev runbook, design system rules
Co-Authored-By: Claude Fable 5.1 <[email protected]>
17 lines
607 B
TypeScript
17 lines
607 B
TypeScript
import { readdirSync } from "node:fs";
|
|
import { describe, expect, it } from "vitest";
|
|
import { MIGRATIONS_DIR } from "../src";
|
|
|
|
describe("migrations", () => {
|
|
it("迁移文件按 NNNN_name.ts 命名且导出 up/down", async () => {
|
|
const files = readdirSync(MIGRATIONS_DIR).filter((f) => f.endsWith(".ts"));
|
|
expect(files.length).toBeGreaterThan(0);
|
|
for (const f of files) {
|
|
expect(f).toMatch(/^\d{4}_[a-z0-9_]+\.ts$/);
|
|
const mod = await import(`${MIGRATIONS_DIR}/${f}`);
|
|
expect(typeof mod.up).toBe("function");
|
|
expect(typeof mod.down).toBe("function");
|
|
}
|
|
});
|
|
});
|