24 lines
1.3 KiB
JavaScript
24 lines
1.3 KiB
JavaScript
import assert from 'node:assert/strict'
|
|
import { readFile } from 'node:fs/promises'
|
|
import test from 'node:test'
|
|
|
|
const source = await readFile(new URL('./client-quick-order-test-env-acceptance.mjs', import.meta.url), 'utf8')
|
|
|
|
test('quick-order HTTP acceptance uses the same endpoint and skeletal cargo payload as Client', () => {
|
|
assert.match(source, /\/api\/merchant\/v1\/orders\/first-leg\/batch/)
|
|
assert.match(source, /cargoName: '', packageType: 'CARTON', packageCount: 2, grossWeightKg: 0, volumeCbm: 0/)
|
|
assert.match(source, /destinationType: 'FBA'/)
|
|
assert.match(source, /destinationType: 'OVERSEAS'/)
|
|
assert.match(source, /destinationType: 'PRIVATE'/)
|
|
assert.match(source, /addresses\?addressType=PRIVATE_DESTINATION/)
|
|
assert.match(source, /privateDestinationAddressId: String\(privateAddress\.id\)/)
|
|
})
|
|
|
|
test('quick-order HTTP acceptance verifies partial failure, detail ownership, and idempotent replay', () => {
|
|
assert.match(source, /expected succeeded=3/)
|
|
assert.match(source, /invalid channel row must fail independently/)
|
|
assert.match(source, /draft must belong to the authenticated enterprise/)
|
|
assert.match(source, /same idempotency key replays the same quick-order drafts/)
|
|
assert.match(source, /idempotent replay returned different order IDs/)
|
|
})
|