test: Phase 5 verification scripts and opt-in e2e integration spec
Adds scripts to seed scenario data, create Proclamations, snapshot schedules, drive the Kiosk-facing HTTP endpoints, and an opt-in (P5_INTEGRATION=1) Vitest spec exercising create/type/copy against a scratch database. The integration spec is skipped by default so the normal suite needs no DB.
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
import 'dotenv/config';
|
||||
import pg from 'pg';
|
||||
import { PrismaPg } from '@prisma/adapter-pg';
|
||||
import { PrismaClient } from '../src/lib/generated/prisma/client';
|
||||
|
||||
const pool = new pg.Pool({ connectionString: process.env.DATABASE_URL });
|
||||
const prisma = new PrismaClient({ adapter: new PrismaPg(pool) });
|
||||
|
||||
// A handful of real Proclamations so schedule Blocks have valid references.
|
||||
async function main() {
|
||||
const category = await prisma.proclamationCategory.findFirst({ orderBy: { id: 'asc' } });
|
||||
const group = await prisma.proclamationGroup.findFirst({ orderBy: { id: 'asc' } });
|
||||
const freq = await prisma.solfeggioFrequency.findFirst({ orderBy: { id: 'asc' } });
|
||||
if (!category || !group || !freq) throw new Error('seed missing catalog');
|
||||
|
||||
const names = ['P5 Dawn', 'P5 Dusk', 'P5 Noon', 'P5 Night'];
|
||||
const ids: string[] = [];
|
||||
for (const name of names) {
|
||||
const existing = await prisma.proclamation.findUnique({ where: { name } });
|
||||
if (existing) {
|
||||
ids.push(existing.id);
|
||||
continue;
|
||||
}
|
||||
const created = await prisma.proclamation.create({
|
||||
data: {
|
||||
name,
|
||||
content: `<p>${name} content</p>`,
|
||||
categoryId: category.id,
|
||||
groupId: group.id,
|
||||
solfeggioFrequencyId: freq.id
|
||||
}
|
||||
});
|
||||
ids.push(created.id);
|
||||
}
|
||||
console.log(JSON.stringify(ids));
|
||||
await prisma.$disconnect();
|
||||
await pool.end();
|
||||
}
|
||||
|
||||
main().catch(async (e) => {
|
||||
console.error(e);
|
||||
await prisma.$disconnect();
|
||||
await pool.end();
|
||||
process.exit(1);
|
||||
});
|
||||
Reference in New Issue
Block a user