From 37ae6c8ac8d08db7b27c5a26078ff3a04d56c3d1 Mon Sep 17 00:00:00 2001 From: enlineawork Date: Wed, 9 Sep 2026 21:09:20 -0300 Subject: [PATCH] test(F6.1): lock area-owned DB context constraint --- .../unit/f6-1-operational-context-db-check.test.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 api-v3/test/unit/f6-1-operational-context-db-check.test.ts 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/); +});