32 lines
1.5 KiB
TypeScript
32 lines
1.5 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 DTOs from the active code surface', () => {
|
|
assert.equal(fs.existsSync(path.join(root, 'src/survey-planning/dto/create-survey-campaign.dto.ts')), false);
|
|
assert.equal(fs.existsSync(path.join(root, 'src/survey-planning/dto/add-survey-target.dto.ts')), false);
|
|
});
|
|
|
|
test('F4 drops Survey planning tables after removing their permissions', () => {
|
|
assert.match(migration, /DELETE FROM permissions/);
|
|
assert.match(migration, /DROP TABLE IF EXISTS survey_campaign_targets/);
|
|
assert.match(migration, /DROP TABLE IF EXISTS survey_campaigns/);
|
|
assert.doesNotMatch(migration, /DROP TABLE IF EXISTS survey_campaigns CASCADE/);
|
|
});
|
|
|
|
test('F4 rollback can reconstruct historical Survey planning dates and asset references', () => {
|
|
assert.match(migration, /CREATE TABLE IF NOT EXISTS survey_campaigns/);
|
|
assert.match(migration, /planned_start_at timestamptz/);
|
|
assert.match(migration, /planned_end_at timestamptz/);
|
|
assert.match(migration, /scope_asset_id uuid REFERENCES assets\(id\) ON DELETE RESTRICT/);
|
|
assert.match(migration, /CREATE TABLE IF NOT EXISTS survey_campaign_targets/);
|
|
assert.match(migration, /asset_id uuid NOT NULL REFERENCES assets\(id\) ON DELETE RESTRICT/);
|
|
});
|