优化 affiliate-dash 成功后绑定快照

This commit is contained in:
yml2213
2026-08-07 12:14:53 +08:00
parent dc3fd63b04
commit 3a2147e94b
2 changed files with 81 additions and 1 deletions
@@ -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,
)
})