优化 affiliate-dash 成功后绑定快照
This commit is contained in:
@@ -4,6 +4,7 @@ import assert from 'node:assert/strict'
|
||||
import {
|
||||
canReuseAffiliateDashBindSnapshot,
|
||||
isAffiliateDashBindSnapshotStale,
|
||||
shouldRefreshAffiliateDashBindStateForSnapshot,
|
||||
} from './kuaishou-cloud-claim-service.js'
|
||||
|
||||
test('isAffiliateDashBindSnapshotStale detects bind uuid that belongs to old uid', () => {
|
||||
@@ -136,3 +137,47 @@ test('canReuseAffiliateDashBindSnapshot refuses mismatched bound account', () =>
|
||||
false,
|
||||
)
|
||||
})
|
||||
|
||||
test('shouldRefreshAffiliateDashBindStateForSnapshot keeps polling before submit', () => {
|
||||
assert.equal(
|
||||
shouldRefreshAffiliateDashBindStateForSnapshot({
|
||||
taskStatus: 'waiting_binding',
|
||||
orderStatus: 'paid',
|
||||
submitStatus: '',
|
||||
}),
|
||||
true,
|
||||
)
|
||||
})
|
||||
|
||||
test('shouldRefreshAffiliateDashBindStateForSnapshot stops after submit starts', () => {
|
||||
assert.equal(
|
||||
shouldRefreshAffiliateDashBindStateForSnapshot({
|
||||
taskStatus: 'redeeming',
|
||||
orderStatus: 'delivering',
|
||||
submitStatus: 'delivering',
|
||||
}),
|
||||
false,
|
||||
)
|
||||
})
|
||||
|
||||
test('shouldRefreshAffiliateDashBindStateForSnapshot stops after delivered', () => {
|
||||
assert.equal(
|
||||
shouldRefreshAffiliateDashBindStateForSnapshot({
|
||||
taskStatus: 'redeemed',
|
||||
orderStatus: 'delivered',
|
||||
submitStatus: 'delivered',
|
||||
}),
|
||||
false,
|
||||
)
|
||||
})
|
||||
|
||||
test('shouldRefreshAffiliateDashBindStateForSnapshot stops for failed platform result', () => {
|
||||
assert.equal(
|
||||
shouldRefreshAffiliateDashBindStateForSnapshot({
|
||||
taskStatus: 'retry_pending',
|
||||
orderStatus: 'ship_failed',
|
||||
submitStatus: '',
|
||||
}),
|
||||
false,
|
||||
)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user