import assert from 'node:assert/strict' import { existsSync, readFileSync } from 'node:fs' import { dirname, resolve } from 'node:path' import test from 'node:test' import { fileURLToPath } from 'node:url' const scriptsDir = dirname(fileURLToPath(import.meta.url)) const backendScript = readFileSync(resolve(scriptsDir, 'backend-full-regression.ps1'), 'utf8') const adminAcceptance = readFileSync(resolve(scriptsDir, 'admin-test-env-acceptance.mjs'), 'utf8') test('backend full regression includes file reactor and critical file/container coverage', () => { assert.match(backendScript, /-pl["',\s\S]*order,firstleg,iam,gateway,file/) for (const required of [ 'file/src/test/java/com/baiyue/file/controller/QualificationFileContractTest.java', 'file/src/test/java/com/baiyue/file/controller/InternalBusinessFileControllerTest.java', 'file/src/test/java/com/baiyue/file/service/InternalBusinessFileServiceTest.java', 'firstleg/src/test/java/com/baiyue/firstleg/controller/ContainerControllerContractTest.java', 'firstleg/src/test/java/com/baiyue/firstleg/controller/LoadingListControllerContractTest.java', 'firstleg/src/test/java/com/baiyue/firstleg/repository/ContainerOverviewSqlContractTest.java', 'firstleg/src/test/java/com/baiyue/firstleg/service/ContainerOverviewServiceTest.java', 'firstleg/src/test/java/com/baiyue/firstleg/service/LoadingListServiceTest.java', ]) assert.match(backendScript, new RegExp(required.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'))) }) test('test-environment full acceptance registers container overview module', () => { const modulePath = resolve(scriptsDir, 'admin-test-env-modules', 'phase3-container-overview.mjs') if (!adminAcceptance.includes('phase3-container-overview') || !existsSync(modulePath)) { assert.fail('default acceptance module phase3-container-overview is not registered yet') } }) test('test-environment full acceptance executes warehouse-scoped booking channel isolation', () => { const loadingModulePath = resolve(scriptsDir, 'admin-test-env-modules', 'phase3-container-loading.mjs') const fixturePath = resolve(scriptsDir, 'admin-test-env-modules', 'ocean-booking-fixture.mjs') assert.match(adminAcceptance, /CONFIGURED_MODULES\s*=\s*\[[^\]]*'phase3-container-loading'/s) assert.ok(existsSync(loadingModulePath), 'phase3-container-loading module is missing') assert.ok(existsSync(fixturePath), 'shared ocean booking fixture is missing') const loadingModule = readFileSync(loadingModulePath, 'utf8') const fixture = readFileSync(fixturePath, 'utf8') assert.match(loadingModule, /publishPlatformLogisticsChannels\(context, warehouseId, MODULE\)/) assert.match(loadingModule, /selectPlatformChannelIsolationPair/) assert.match(loadingModule, /BLOCKED_FIXTURE/) assert.match(fixture, /\/api\/platform\/v1\/ocean-bookings\/channels/) assert.match(fixture, /createdResources\.platformLogisticsChannels/) })