31 lines
998 B
TypeScript
31 lines
998 B
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',
|
|
'022_vulnerability_finding_result_type.sql'
|
|
);
|
|
|
|
describe('PostgreSQL vulnerability finding result type migration', () => {
|
|
it('registers migration 022 after CVE enrichment', () => {
|
|
expect(databaseMigrations.at(-1)).toMatchObject({
|
|
version: '022',
|
|
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);
|
|
});
|
|
});
|