This commit is contained in:
2026-10-27 17:44:41 +08:00
parent 57cd211973
commit db0e72daeb
37 changed files with 701 additions and 671 deletions
@@ -8,7 +8,9 @@ import { PRIVATE_DIRECTORY, runGrayUiFixture, runUiFixture, uiActorPermissions,
const args = ['--execute', '--environment', 'GRAY', '--run-id', 'ui-gray-offline', '--warehouse-id', '900',
'--destination-warehouse-id', '901', '--private-credentials-file', join(PRIVATE_DIRECTORY, 'ui-gray-offline.json')]
const env = { CHONGCHONG_ENV: 'prod', CHONGCHONG_ADMIN_API_BASE_URL: 'https://gray.example.invalid/api',
CHONGCHONG_ADMIN_USERNAME: 'offline', CHONGCHONG_ADMIN_PASSWORD: 'offline-only' }
CHONGCHONG_ADMIN_USERNAME: 'offline', CHONGCHONG_ADMIN_PASSWORD: 'offline-only',
CHONGCHONG_ACCEPTANCE_CUSTOMER_ID: '100', CHONGCHONG_MERCHANT_USERNAME: 'existing-a', CHONGCHONG_MERCHANT_PASSWORD: 'offline-a',
CHONGCHONG_ACCEPTANCE_SECONDARY_CUSTOMER_ID: '101', CHONGCHONG_SECONDARY_MERCHANT_USERNAME: 'existing-b', CHONGCHONG_SECONDARY_MERCHANT_PASSWORD: 'offline-b' }
test('GRAY UI default plan does not access network or private credential files and keeps only four drafts', async () => {
const original = globalThis.fetch; globalThis.fetch = () => assert.fail('no network')
@@ -40,6 +42,14 @@ test('GRAY UI refuses TEST profile or evidence overrides and TEST runner rejects
await assert.rejects(runGrayUiFixture(config, { env: { ...env, CHONGCHONG_ADMIN_API_BASE_URL: 'http://gray.example.invalid/api' } }), /INVALID_UI_API_BASE/)
})
test('GRAY UI missing second fixed customer stops before context private files or network', async () => {
const original = globalThis.fetch; globalThis.fetch = () => assert.fail('no network')
try {
const missing = { ...env }; delete missing.CHONGCHONG_ACCEPTANCE_SECONDARY_CUSTOMER_ID
await assert.rejects(runGrayUiFixture(parseGrayUiFixtureArguments(args), { env: missing }), /第二个客户/)
} finally { globalThis.fetch = original }
})
test('only sales A receives quotation-read while dispatcher and sales B remain minimal', () => {
const prefix = 'platform:fleet:capacity-offer:'
const sales = ['list', 'inquiry-create', 'inquiry-edit', 'inquiry-cancel'].map(value => prefix + value)