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', '004_gpo_ingestion_job.sql'); describe('PostgreSQL GPO ingestion job migration', () => { it('adds the GPO analysis job kind without rewriting historical migrations', async () => { const sql = await readFile(migrationPath, 'utf8'); expect(databaseMigrations.find(migration => migration.version === '004')).toMatchObject({ version: '004', name: 'gpo-ingestion-job' }); expect(sql).toContain('DROP CONSTRAINT assessor_ingestion_jobs_job_kind_check'); expect(sql).toContain("'analyze-gpo-backup'"); }); });