31 lines
1.0 KiB
TypeScript
31 lines
1.0 KiB
TypeScript
import { readFile } from 'node:fs/promises';
|
|
import { resolve } from 'node:path';
|
|
import { describe, expect, it } from 'vitest';
|
|
import { databaseMigrations } from '../../server/postgres/migration-catalog';
|
|
|
|
const migrationPath = resolve(
|
|
import.meta.dirname,
|
|
'..',
|
|
'..',
|
|
'server',
|
|
'postgres',
|
|
'migrations',
|
|
'027_vulnerability_finding_result_type.sql'
|
|
);
|
|
|
|
describe('PostgreSQL vulnerability finding result type migration', () => {
|
|
it('registers migration 027 after regulatory mapping', () => {
|
|
expect(databaseMigrations.find(item => item.version === '027')).toMatchObject({
|
|
version: '027',
|
|
name: 'vulnerability-finding-result-type'
|
|
});
|
|
});
|
|
|
|
it('extends the closed result type constraint without rewriting occurrences', async () => {
|
|
const sql = await readFile(migrationPath, 'utf8');
|
|
expect(sql).toContain("'vulnerability_finding'");
|
|
expect(sql).toContain('assessor_occurrences_result_type_check');
|
|
expect(sql).not.toMatch(/UPDATE\s+assessor_finding_occurrences/i);
|
|
});
|
|
});
|