import assert from 'node:assert/strict'; import { readFileSync } from 'node:fs'; import { resolve } from 'node:path'; import test from 'node:test'; const source = (path: string) => readFileSync(resolve(process.cwd(), path), 'utf8'); const service = source('src/field-briefing/field-briefing.service.ts'); const controller = source('src/field-briefing/field-briefing.controller.ts'); test('F1.3 prepares field briefing from prior Acts in the same operational context', () => { assert.match(service, /source_visit\.operational_area_id = \$2/); assert.match(service, /source_visit\.operator_company_id = \$3/); assert.match(service, /source_visit\.id <> \$1/); }); test('F1.3 uses Act-level deadline and company response ledgers', () => { assert.match(service, /inspection_act_deadline_events/); assert.match(service, /inspection_act_company_responses/); assert.doesNotMatch(service, /company_response_received_on/); }); test('F1.3 only turns open findings from closed Acts into pending field context', () => { assert.match(service, /act\.status IN \('CLOSED', 'RECTIFIED'\)/); assert.match(service, /finding\.status = 'OPEN'/); }); test('F1.3 separates required field review, upcoming review and administrative context', () => { assert.match(service, /'REQUIRED'/); assert.match(service, /'UPCOMING'/); assert.match(service, /'CONTEXT'/); assert.match(service, /ADMIN_RESPONSE_OVERDUE/); }); test('F1.3 exposes the briefing through the inspection read contract', () => { assert.match(controller, /field-briefing/); assert.match(controller, /inspections\.read/); });