import test from "node:test";import assert from "node:assert/strict";import fs from "node:fs";
const read=p=>fs.readFileSync(new URL(`../${p}`,import.meta.url),"utf8");
test("registration writes to the database",()=>{assert.match(read("components/public-form.tsx"),/\/api\/register/);assert.match(read("app/api/register/route.ts"),/INSERT INTO registrations/)});
test("Stripe webhook verifies signatures and is idempotent",()=>{const s=read("app/api/stripe/webhook/route.ts");assert.match(s,/stripe-signature/);assert.match(s,/webhook_events/);assert.match(s,/payment_status='successful'/)});
test("admin data is protected",()=>{assert.match(read("app/api/admin/data/route.ts"),/requireAdmin/);assert.match(read("lib/server.ts"),/admin_sessions/)});
test("example environment contains no live Stripe key",()=>{const e=read(".env.example");assert.doesNotMatch(e,/sk_live_[A-Za-z0-9]+/);assert.match(e,/STRIPE_WEBHOOK_SECRET/)})
