forked from unimatrix/web
3 lines
916 B
JavaScript
3 lines
916 B
JavaScript
import test from 'node:test';import assert from 'node:assert/strict';import {staffBureauSchema,initializeStaffBureau} from '../node/staff-bureau-schema.mjs';
|
|
test('shadow schema contains all seven staff bureau tables',()=>{assert.equal(staffBureauSchema.length,7);for(const name of ['staff_departments','staff_positions','staff_position_history','staff_promotion_requests','staff_duty_grants','staff_permission_policies','staff_audit_events'])assert.ok(staffBureauSchema.some(sql=>sql.includes('CREATE TABLE IF NOT EXISTS '+name)),name);});
|
|
test('initializer creates tables and seeds four departments without assigning users',async()=>{const queries=[];const db={prepare(sql){queries.push(sql);return{run:async()=>{},bind(){return this}}}};await initializeStaffBureau(db);assert.equal(queries.filter(s=>s.startsWith('INSERT IGNORE')).length,4);assert.ok(!queries.some(s=>/INSERT INTO staff_positions/i.test(s)));});
|

Staff