32 lines
1017 B
JavaScript
32 lines
1017 B
JavaScript
import { describe, it, expect } from 'vitest'
|
||
import * as fc from 'fast-check'
|
||
import { resolvePaymentChannel } from '../utils/payment.js'
|
||
|
||
describe('Property 16: 支付渠道平台选择', () => {
|
||
/**
|
||
* **Feature: mobile-app, Property 16: 支付渠道平台选择**
|
||
* **Validates: Requirements 12.2, 12.3**
|
||
*
|
||
* 对于任意支付请求,当平台为Android时应调用Google Pay接口,
|
||
* 当平台为iOS时应调用Apple Pay接口。
|
||
*/
|
||
it('Android平台应选择Google Pay,iOS平台应选择Apple Pay', () => {
|
||
const platformArb = fc.constantFrom('android', 'ios', 'unknown')
|
||
|
||
fc.assert(
|
||
fc.property(platformArb, (platform) => {
|
||
const channel = resolvePaymentChannel(platform)
|
||
|
||
if (platform === 'android') {
|
||
expect(channel).toBe('google_pay')
|
||
} else if (platform === 'ios') {
|
||
expect(channel).toBe('apple_pay')
|
||
} else {
|
||
expect(channel).toBe('unsupported')
|
||
}
|
||
}),
|
||
{ numRuns: 100 }
|
||
)
|
||
})
|
||
})
|