diff --git a/api-v3/test/unit/f6-1-operational-context-db-check.test.ts b/api-v3/test/unit/f6-1-operational-context-db-check.test.ts new file mode 100644 index 0000000..9820163 --- /dev/null +++ b/api-v3/test/unit/f6-1-operational-context-db-check.test.ts @@ -0,0 +1,13 @@ +import assert from 'node:assert/strict'; +import { readFileSync } from 'node:fs'; +import { resolve } from 'node:path'; +import test from 'node:test'; + +test('F6.1 DB check allows Área-only physical context and rejects Company without Área', () => { + const migration=readFileSync( + resolve(process.cwd(),'src/database/migrations/1790094500000-f6-1-area-owned-operational-context-check.ts'), + 'utf8', + ); + assert.match(migration,/CHECK \(operator_company_id IS NULL OR operational_area_id IS NOT NULL\)/); + assert.doesNotMatch(migration,/operational_area_id IS NULL OR operator_company_id IS NULL/); +});