feat: ship Wave 5-6 multi-surface hygiene, optimization, and bug fixes
This commit is contained in:
parent
01ef3293cf
commit
66b6b45ba9
399 changed files with 17828 additions and 11330 deletions
|
|
@ -185,3 +185,52 @@ Deno.test('Payple charge amounts are the core plan catalog prices', () => {
|
|||
assert(TIER_PRICE.pro_plus === PLAN_PRICE_KRW.pro_plus, 'Pro+ charge must equal PLAN_PRICE_KRW.pro_plus')
|
||||
assert(Object.keys(TIER_PRICE).sort().join(',') === 'pro,pro_plus', 'only paid tiers are chargeable')
|
||||
})
|
||||
|
||||
Deno.test('Payple HTTP helpers attach an AbortSignal timeout and fail closed on malformed JSON', async () => {
|
||||
const config = buildPaypleConfig(validConfig)
|
||||
const auth = {
|
||||
PCD_CST_ID: 'encrypted-id',
|
||||
PCD_CUST_KEY: 'encrypted-key',
|
||||
PCD_AUTH_KEY: 'auth-key',
|
||||
PCD_PAY_HOST: 'https://cpay.payple.kr',
|
||||
PCD_PAY_URL: 'https://cpay.payple.kr',
|
||||
}
|
||||
const seenSignals: boolean[] = []
|
||||
const originalFetch = globalThis.fetch
|
||||
globalThis.fetch = (_input, init) => {
|
||||
const signal = init && 'signal' in init ? init.signal : undefined
|
||||
seenSignals.push(signal instanceof AbortSignal)
|
||||
return Promise.resolve(new Response('not-json', { status: 200 }))
|
||||
}
|
||||
try {
|
||||
let billingErr: unknown
|
||||
try {
|
||||
await paypleBilling(config, auth, {
|
||||
payerId: 'payer-fixture',
|
||||
amount: TIER_PRICE.pro,
|
||||
orderId: 'D3RO-20260821153045-test-nonce',
|
||||
goodsName: 'D3RO Voice Pro',
|
||||
})
|
||||
} catch (caught) {
|
||||
billingErr = caught
|
||||
}
|
||||
assert(
|
||||
billingErr instanceof PaypleBillingError && billingErr.code === 'payple_billing_response_unknown',
|
||||
'invalid billing json maps to ambiguous error',
|
||||
)
|
||||
|
||||
let authErr: unknown
|
||||
try {
|
||||
await paypleAuth(config, { simpleFlag: true })
|
||||
} catch (caught) {
|
||||
authErr = caught
|
||||
}
|
||||
assert(
|
||||
authErr instanceof PaypleVerificationError && authErr.code === 'payple_auth_invalid_response',
|
||||
'invalid auth json fails closed',
|
||||
)
|
||||
assert(seenSignals.length === 2 && seenSignals.every(Boolean), 'all Payple fetch calls must pass AbortSignal')
|
||||
} finally {
|
||||
globalThis.fetch = originalFetch
|
||||
}
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue