fix: complete GCP synthetic single-order acceptance and align booking collation [skip ci]

This commit is contained in:
2026-10-24 19:20:44 +08:00
parent 493656e677
commit 5cc6f617f5
13 changed files with 420 additions and 83 deletions
+18 -3
View File
@@ -114,14 +114,14 @@ test('execute, resume and unrecognized arguments fail closed', async () => {
})
test('explicit gray/test mode shares one API base and rejects retired environment keys', () => {
for (const mode of ['gray', 'test']) {
test('explicit gray/test/gcp-test mode shares one API base and rejects retired environment keys', () => {
for (const mode of ['gray', 'test', 'gcp-test']) {
const settings = config({ ...environment(), CHONGCHONG_ENV: mode })
assert.equal(settings.environment, mode)
assert.equal(settings.apiBase, 'https://acceptance.invalid/api')
assert.equal(settings.overseas, undefined)
}
for (const mode of ['prod', 'dev', '', undefined]) {
for (const mode of ['prod', 'dev', 'GCP-TEST', 'gcp', '', undefined]) {
assert.throws(() => config({ ...environment(), CHONGCHONG_ENV: mode }), /显式配置/)
}
for (const key of ['CHONGCHONG_ADMIN_OVERSEAS_API_BASE_URL', 'CHONGCHONG_MERCHANT_OVERSEAS_API_BASE_URL']) {
@@ -129,6 +129,21 @@ test('explicit gray/test mode shares one API base and rejects retired environmen
}
})
test('gcp-test preserves its explicit target and cannot fall back to a different customer gateway', () => {
const env = { ...environment(), CHONGCHONG_ENV: 'gcp-test',
CHONGCHONG_ADMIN_API_BASE_URL: 'https://gcp-fixture.invalid/api',
CHONGCHONG_MERCHANT_API_BASE_URL: 'https://gcp-fixture.invalid/api' }
assert.equal(config(env).environment, 'gcp-test')
assert.equal(config(env).apiBase, 'https://gcp-fixture.invalid/api')
assert.throws(() => config({ ...env, CHONGCHONG_MERCHANT_API_BASE_URL: 'https://other-fixture.invalid/api' }), /同一 HTTPS/)
for (const value of ['http://gcp-fixture.invalid/api', 'https://gcp-fixture.invalid/', undefined]) {
assert.throws(() => config({ ...env, CHONGCHONG_ADMIN_API_BASE_URL: value }))
}
for (const key of ['CHONGCHONG_ADMIN_OVERSEAS_API_BASE_URL', 'CHONGCHONG_MERCHANT_OVERSEAS_API_BASE_URL']) {
assert.throws(() => config({ ...env, [key]: env.CHONGCHONG_ADMIN_API_BASE_URL }), /旧海外网关/)
}
})
test('overseas PDA calls the unified gateway using its ordinary access token', async () => {
const calls = []
const http = client(config(environment()), async (url, options) => {