Files
sufw-webseite-terminplanung/development-system/tests/booking-migrations.test.mjs
T

25 lines
1.2 KiB
JavaScript

import assert from 'node:assert/strict';
import { readFile } from 'node:fs/promises';
import test from 'node:test';
test('liefert eine externe, idempotente Anfangsmigration für Termine und Anmeldungen', async () => {
const migration = await readFile(new URL('../database/migrations/001_booking_schema.sql', import.meta.url), 'utf8');
assert.match(migration, /CREATE TABLE IF NOT EXISTS `sufw_booking_events`/);
assert.match(migration, /CREATE TABLE IF NOT EXISTS `sufw_booking_registrations`/);
assert.match(migration, /FOREIGN KEY \(`event_id`\)/);
assert.match(migration, /CHECK \(`capacity` BETWEEN 1 AND 100\)/);
});
test('hält die statische Vorschaukopie der Buchungsassets identisch', async () => {
const [componentScript, previewScript, componentStyle, previewStyle] = await Promise.all([
readFile(new URL('../public/booking/booking.js', import.meta.url), 'utf8'),
readFile(new URL('../public/perspektivwerk/js/booking.js', import.meta.url), 'utf8'),
readFile(new URL('../public/booking/booking.css', import.meta.url), 'utf8'),
readFile(new URL('../public/perspektivwerk/js/booking.css', import.meta.url), 'utf8'),
]);
assert.equal(previewScript, componentScript);
assert.equal(previewStyle, componentStyle);
});