feat(learner): package scaffold, auth tables migration, migrations runner
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
0b117159cd
commit
5a215744e5
@@ -0,0 +1,13 @@
|
||||
import { expect } from "bun:test";
|
||||
import { runMigrations } from "../src/server/migrate";
|
||||
import { forEachDb } from "./helpers";
|
||||
|
||||
forEachDb("learner migrations create the auth tables and are idempotent", async (db) => {
|
||||
for (const t of ["auth_user", "auth_session", "auth_account", "auth_verification", "auth_sso_provider", "learner_meta", "learner_group_claims"]) {
|
||||
const rows = await db.sql.unsafe(`SELECT COUNT(*) AS n FROM ${t}`);
|
||||
expect(Number(rows[0].n)).toBe(0);
|
||||
}
|
||||
expect(await runMigrations(db)).toEqual([]);
|
||||
const names = (await db.sql`SELECT name FROM schema_migrations`).map((r: { name: string }) => r.name);
|
||||
expect(names).toContain("0001_learner_auth.sql");
|
||||
});
|
||||
Reference in New Issue
Block a user