Files
dh-inspeccion-v2/api-v3/test/unit/survey-execution-authorization.test.ts
T

25 lines
1006 B
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 the Survey execution controller from the active API', () => {
assert.equal(fs.existsSync(path.join(root, 'src/survey-execution/survey-execution.controller.ts')), false);
assert.equal(fs.existsSync(path.join(root, 'src/survey-execution/survey-execution.service.ts')), false);
});
test('F4 removes Survey execution and review permissions from active authorization', () => {
assert.match(migration, /'surveys\.execute'/);
assert.match(migration, /'surveys\.read_reports'/);
assert.match(migration, /'surveys\.capture'/);
assert.match(migration, /'surveys\.review'/);
assert.match(migration, /DELETE FROM role_permissions/);
assert.match(migration, /DELETE FROM permissions/);
});