This commit is contained in:
2026-08-14 16:06:33 +08:00
parent 09e44e6520
commit 610cc1abf9
17 changed files with 135 additions and 41 deletions
@@ -49,7 +49,8 @@ test('maps transport and status fields instead of treating container mode as tra
assert.match(storeSource, /status === 'SUBMITTED'\) return 'PENDING_REVIEW'/)
assert.match(storeSource, /status === 'REJECTED'\) return 'PENDING_REVIEW'/)
assert.match(storeSource, /status === 'APPROVED' \|\| status === 'ACCEPTED' \|\| status === 'PROCESSING'\) return 'WAIT_MEASURE'/)
assert.match(storeSource, /status === 'COMPLETED'\) return 'DELIVERED'/)
assert.match(storeSource, /status === 'COMPLETED'\) return 'LOADED'/)
assert.doesNotMatch(storeSource, /status === 'COMPLETED'\) return 'DELIVERED'/)
})
test('prefers unified reads and only falls back to the real legacy API when C02 is unavailable', () => {
@@ -148,10 +149,13 @@ test('does not expose the out-of-scope cancellation write', () => {
test('sends an idempotency key for create and submit writes', () => {
assert.match(apiSource, /'Idempotency-Key': createIdempotencyKey\('first-leg-create'\)/)
assert.match(apiSource, /'Idempotency-Key': createIdempotencyKey\(`first-leg-submit-\$\{id\}`\)/)
assert.match(apiSource, /submitMerchantFirstLegOrder\(id: number \| string, idempotencyKey: string\)/)
assert.match(apiSource, /'Idempotency-Key': idempotencyKey/)
assert.match(apiSource, /createMerchantFirstLegOrderBatch\(items: MerchantBatchDraftItem\[\], idempotencyKey: string\)/)
assert.match(apiSource, /headers: \{ 'Idempotency-Key': idempotencyKey \}/)
assert.match(storeSource, /createMerchantFirstLegOrderBatch\(items, idempotencyKey\)/)
assert.match(storeSource, /pendingSubmitKeys\.get\(id\) \?\? createIdempotencyKey\(`first-leg-submit-\$\{id\}`\)/)
assert.match(storeSource, /submitMerchantFirstLegOrder\(id, idempotencyKey\)/)
})
test('does not expose the contradictory backend rejected state in the client model', () => {