30 lines
1.2 KiB
TypeScript
30 lines
1.2 KiB
TypeScript
import assert from 'node:assert/strict';
|
|
import fs from 'node:fs';
|
|
import path from 'node:path';
|
|
import test from 'node:test';
|
|
|
|
const root = process.cwd();
|
|
const migration = fs.readFileSync(
|
|
path.join(root, 'src/database/migrations/1790000300000-f4-remove-survey-subsystem.ts'),
|
|
'utf8',
|
|
);
|
|
|
|
test('F4 removes Survey planning controllers from the active API', () => {
|
|
assert.equal(fs.existsSync(path.join(root, 'src/survey-planning/survey-campaigns.controller.ts')), false);
|
|
assert.equal(fs.existsSync(path.join(root, 'src/survey-planning/survey-campaigns.service.ts')), false);
|
|
});
|
|
|
|
test('F4 removes Survey planning permissions and their role bindings', () => {
|
|
assert.match(migration, /'surveys\.read'/);
|
|
assert.match(migration, /'surveys\.manage'/);
|
|
assert.match(migration, /'surveys\.assign'/);
|
|
assert.match(migration, /DELETE FROM role_permissions/);
|
|
assert.match(migration, /DELETE FROM permissions/);
|
|
});
|
|
|
|
test('F4 rollback retains the former role-permission map only as a reversible migration path', () => {
|
|
assert.match(migration, /const rolePermissionValues/);
|
|
assert.match(migration, /WITH mapping\(role_code,permission_code\)/);
|
|
assert.match(migration, /INSERT INTO role_permissions/);
|
|
});
|