Files
admin-web/scripts/phase4-test-frontend-contract.test.mjs
T

35 lines
1.5 KiB
JavaScript
Raw Normal View History

import assert from 'node:assert/strict'
import { readFileSync } from 'node:fs'
import test from 'node:test'
2026-09-29 18:47:41 +08:00
const runner = readFileSync(new URL('./phase4-test-frontend-acceptance.mjs', import.meta.url), 'utf8')
const suite = readFileSync(new URL('./phase4-test-frontend.acceptance.ts', import.meta.url), 'utf8')
2026-09-29 18:47:41 +08:00
test('test runner requires an explicit test environment and unified gateway', () => {
assert.match(runner, /--environment/)
2026-09-29 18:47:41 +08:00
assert.match(runner, /environment !== 'test'/)
assert.match(runner, /--gateway/)
2026-09-29 18:47:41 +08:00
assert.doesNotMatch(runner, /--overseas-gateway|VITE_OVERSEAS/)
assert.match(runner, /shell: process\.platform === 'win32'/)
assert.match(runner, /if \(result\.error\) throw result\.error/)
assert.doesNotMatch(runner, /ADMIN_ACCEPTANCE_PASSWORD\s*[:=]\s*['"][^'"]+['"]/)
})
test('live suite uses production auth clients and domain adapters', () => {
assert.match(suite, /useAuthStore/)
2026-09-29 18:47:41 +08:00
assert.match(suite, /refreshAuthenticatedSession/)
assert.match(suite, /createQuote/)
assert.match(suite, /createUsTruckOrder/)
assert.match(suite, /createLocalLooseboardOrder/)
assert.match(suite, /listLastMileOrders/)
assert.match(suite, /listDispatchCandidates/)
assert.match(suite, /listCarrierScheduleQueries/)
})
test('live suite owns marker resources and redacts credentials from trace reports', () => {
assert.match(suite, /ADMIN-FRONT-P4-/)
assert.match(suite, /password\|token\|authorization/i)
assert.match(suite, /createdResources/)
assert.match(suite, /coverageGaps/)
})