This commit is contained in:
2026-09-03 17:49:09 +08:00
parent e25a244ed9
commit 72d77a7f70
6 changed files with 117 additions and 13 deletions
@@ -6,9 +6,17 @@ const source = readFileSync(new URL('./inboundBilling.ts', import.meta.url), 'ut
const typesSource = readFileSync(new URL('../types/inboundBilling.ts', import.meta.url), 'utf8')
test('queries the merchant order inbound-billing endpoint without tenant parameters', () => {
assert.match(source, /url: `\/merchant\/v1\/first-leg\/orders\/\$\{orderId\}\/inbound-billing`/)
assert.match(source, /method: 'GET'/)
assert.doesNotMatch(source, /tenantId|method: '(?:POST|PUT|PATCH|DELETE)'/)
const readSource = source.slice(source.indexOf('export async function getMerchantInboundBilling'), source.indexOf('function createFeeConfirmationKey'))
assert.match(readSource, /url: `\/merchant\/v1\/first-leg\/orders\/\$\{orderId\}\/inbound-billing`/)
assert.match(readSource, /method: 'GET'/)
assert.doesNotMatch(readSource, /tenantId|method: '(?:POST|PUT|PATCH|DELETE)'/)
})
test('confirms the latest customer fee version with an idempotency key', () => {
assert.match(source, /function confirmMerchantInboundFee/)
assert.match(source, /\/inbound-billing\/confirm/)
assert.match(source, /headers: \{ 'Idempotency-Key': idempotencyKey \}/)
assert.match(source, /data: \{ expectedFeeVersion \}/)
})
test('sanitizes the platform-shaped response into a merchant whitelist', () => {