@jetthai/cuora 1.1.488 → 2.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.husky/pre-commit +3 -1
- package/BREAKING_CHANGES.md +9 -0
- package/CHANGELOG.md +3 -316
- package/README.md +15 -299
- package/package.json +5 -5
- package/resetGitBranch.sh +101 -0
- package/src/api/account.js +1 -0
- package/src/api/activity.js +39 -24
- package/src/api/auth.js +36 -5
- package/src/api/common.js +3 -5
- package/src/api/game.js +10 -0
- package/src/api/payment.js +55 -17
- package/src/api/user.js +16 -10
- package/src/index.js +2 -2
- package/src/lib/fingerprint_v3_11_12.js +11433 -0
- package/src/machine/activity/activity.js +213 -0
- package/src/machine/activity/activity_cash.js +36 -84
- package/src/machine/activity/cash_rain_activity.js +1 -0
- package/src/machine/activity/continue_deposit_activity.js +1 -0
- package/src/machine/activity/deposit_activity.js +1 -0
- package/src/machine/activity/diamond_shop_activity_cash.js +8 -0
- package/src/machine/activity/diamond_shop_activity_fc.js +197 -0
- package/src/machine/activity/diamond_shop_activity_vn.js +179 -0
- package/src/machine/activity/fafafa_activity.js +11 -0
- package/src/machine/activity/friend_invite_friends_activity.js +7 -8
- package/src/machine/activity/index.js +12 -0
- package/src/machine/activity/instant_rebate_activity.js +1 -0
- package/src/machine/activity/invite_friends_activity.js +115 -0
- package/src/machine/activity/jackpot.js +1 -0
- package/src/machine/activity/mini_game_activity.js +69 -0
- package/src/machine/activity/otp_verified_activity.js +1 -0
- package/src/machine/activity/ranking_activity.js +1 -0
- package/src/machine/activity/return_bonus_activity.js +155 -0
- package/src/machine/activity/roulette_activity_v2.js +1 -0
- package/src/machine/activity/sign_in_activity.js +1 -0
- package/src/machine/activity/sign_in_monthly_activity.js +2 -1
- package/src/machine/activity/specify_bets_activity.js +1 -0
- package/src/machine/activity/specify_turnover_activity.js +1 -0
- package/src/machine/activity/time_bomb_activity.js +1 -0
- package/src/machine/activity/vip_card_activity.js +1 -0
- package/src/machine/auth.js +112 -149
- package/src/machine/auth_otp_v2.js +178 -0
- package/src/machine/auth_otp_v3.js +22 -64
- package/src/machine/bank_binding.js +3 -2
- package/src/machine/bank_binding_amb.js +146 -0
- package/src/machine/bonus.js +76 -0
- package/src/machine/common.js +98 -14
- package/src/machine/deposit/amb.js +93 -0
- package/src/machine/deposit/crypto_bank.js +340 -0
- package/src/machine/deposit/crypto_bank_cash.js +35 -20
- package/src/machine/deposit/crypto_qrcode.js +158 -0
- package/src/machine/deposit/crypto_qrcode_cash.js +64 -26
- package/src/machine/deposit/crypto_way.js +253 -0
- package/src/machine/deposit/crypto_way_cash.js +37 -48
- package/src/machine/deposit/deposit_fc.js +272 -0
- package/src/machine/deposit/direct.js +311 -0
- package/src/machine/deposit/direct_cash.js +10 -8
- package/src/machine/deposit/float.js +375 -0
- package/src/machine/deposit/index.js +28 -0
- package/src/machine/deposit/krway.js +152 -0
- package/src/machine/deposit/loadcard_cash.js +32 -14
- package/src/machine/deposit/loadcard_vn.js +352 -0
- package/src/machine/deposit/manual_cash.js +11 -8
- package/src/machine/deposit/manual_vn.js +459 -0
- package/src/machine/deposit/qrcode_cash.js +32 -15
- package/src/machine/deposit/qrcode_v2.js +339 -0
- package/src/machine/deposit/usdt.js +163 -0
- package/src/machine/deposit/usdt_cash.js +15 -1
- package/src/machine/deposit/virtual_bank_cash.js +12 -13
- package/src/machine/deposit/virtual_bank_vn.js +270 -0
- package/src/machine/deposit/vpay.js +374 -0
- package/src/machine/error.js +1 -7
- package/src/machine/game_betslip.js +1 -0
- package/src/machine/game_favorite_v2.js +1 -0
- package/src/machine/game_hot_new.js +80 -0
- package/src/machine/game_info.js +13 -1
- package/src/machine/game_replay.js +47 -0
- package/src/machine/game_search_cash.js +1 -0
- package/src/machine/game_search_v2.js +402 -0
- package/src/machine/game_v2_1.js +126 -39
- package/src/machine/honor_board.js +133 -0
- package/src/machine/honor_board_cash.js +28 -22
- package/src/machine/inbox.js +105 -43
- package/src/machine/index.js +32 -0
- package/src/machine/leaderboard.js +12 -8
- package/src/machine/merge.js +58 -0
- package/src/machine/navbar.js +3 -1
- package/src/machine/payment_data.js +87 -0
- package/src/machine/promotions.js +163 -0
- package/src/machine/ranking.js +30 -45
- package/src/machine/reward.js +256 -0
- package/src/machine/reward_cash.js +42 -2
- package/src/machine/reward_fc.js +99 -0
- package/src/machine/roulette_v2.js +11 -14
- package/src/machine/setting.js +1 -0
- package/src/machine/side.js +160 -0
- package/src/machine/side_cash.js +3 -3
- package/src/machine/side_v2.js +223 -0
- package/src/machine/user_info.js +1 -0
- package/src/machine/user_photo.js +1 -0
- package/src/machine/user_reset_password.js +14 -0
- package/src/machine/user_sign_up.js +61 -46
- package/src/machine/vip_table.js +58 -0
- package/src/machine/websocket.js +349 -374
- package/src/machine/welcome.js +111 -0
- package/src/machine/withdraw/index.js +6 -0
- package/src/machine/withdraw/withdraw_crypto_cash.js +328 -0
- package/src/machine/withdraw/withdraw_krway.js +223 -0
- package/src/machine/withdraw/withdraw_manual.js +541 -0
- package/src/machine/withdraw/withdraw_manual_cash.js +39 -59
- package/src/request/config.js +0 -2
- package/src/request/request.js +60 -124
- package/src/util/constant.js +2 -6
- package/src/util/deviceToken.js +60 -0
- package/src/util/index.js +4 -2
- package/src/util/math.js +4 -0
- package/src/util/storage.js +4 -3
- package/test/api.behavior.test.js +69 -0
- package/test/api.contract.test.js +18 -0
- package/test/config.test.js +27 -0
- package/test/deviceToken.test.js +139 -0
- package/test/helpers.coverage.test.js +11 -0
- package/test/helpers.js +91 -0
- package/test/index.exports.test.js +14 -0
- package/test/machine.activity.core.coverage.test.js +337 -0
- package/test/machine.activity.gap.coverage.test.js +252 -0
- package/test/machine.activity.more.coverage.test.js +180 -0
- package/test/machine.activity_plus_and_binding_amb.coverage.test.js +201 -0
- package/test/machine.activity_timer_bonus.coverage.test.js +136 -0
- package/test/machine.activity_welcome.low.coverage.test.js +211 -0
- package/test/machine.amb_rewardfc_websocket.more.coverage.test.js +201 -0
- package/test/machine.auth.coverage.test.js +215 -0
- package/test/machine.bank_binding.test.js +143 -0
- package/test/machine.binding_otp_krway.coverage.test.js +223 -0
- package/test/machine.contract.test.js +50 -0
- package/test/machine.crypto_bank.coverage.test.js +270 -0
- package/test/machine.crypto_way.coverage.test.js +108 -0
- package/test/machine.crypto_way_cash.coverage.test.js +114 -0
- package/test/machine.definition.test.js +137 -0
- package/test/machine.deposit.manual.coverage.test.js +365 -0
- package/test/machine.deposit_fc.coverage.test.js +126 -0
- package/test/machine.direct.coverage.test.js +96 -0
- package/test/machine.direct_cash.coverage.test.js +108 -0
- package/test/machine.error.coverage.test.js +37 -0
- package/test/machine.events.test.js +126 -0
- package/test/machine.favorite_jackpot.coverage.test.js +82 -0
- package/test/machine.float.coverage.test.js +136 -0
- package/test/machine.flow.test.js +226 -0
- package/test/machine.game_hot_new_vip_table.coverage.test.js +105 -0
- package/test/machine.game_search_cash.coverage.test.js +155 -0
- package/test/machine.game_search_v2.test.js +199 -0
- package/test/machine.game_user_profile.coverage.test.js +100 -0
- package/test/machine.honor_board.test.js +133 -0
- package/test/machine.inbox.common.coverage.test.js +304 -0
- package/test/machine.loadcard_cash.coverage.test.js +101 -0
- package/test/machine.loadcard_vn.coverage.test.js +122 -0
- package/test/machine.misc.coverage.test.js +361 -0
- package/test/machine.more2.coverage.test.js +261 -0
- package/test/machine.options.execution.test.js +272 -0
- package/test/machine.priority.coverage.test.js +603 -0
- package/test/machine.qrcode_cash.coverage.test.js +107 -0
- package/test/machine.qrcode_v2.coverage.test.js +121 -0
- package/test/machine.regression.test.js +82 -0
- package/test/machine.roulette_v2.test.js +142 -0
- package/test/machine.side_reward_reset.coverage.test.js +220 -0
- package/test/machine.targeted.coverage.test.js +313 -0
- package/test/machine.usdt.coverage.test.js +95 -0
- package/test/machine.usdt_cash.coverage.test.js +73 -0
- package/test/machine.vip_card_activity.test.js +114 -0
- package/test/machine.virtual_bank_cash.coverage.test.js +105 -0
- package/test/machine.virtual_bank_vn.coverage.test.js +105 -0
- package/test/machine.vpay.coverage.test.js +142 -0
- package/test/machine.withdraw_crypto_cash.coverage.test.js +166 -0
- package/test/machine.withdraw_krway.coverage.test.js +123 -0
- package/test/machine.withdraw_manual.coverage.test.js +185 -0
- package/test/machine.withdraw_manual_cash.coverage.test.js +123 -0
- package/test/request.test.js +325 -0
- package/test/util.storage.errors.test.js +47 -0
- package/test/util.test.js +41 -0
- package/.claude/commands/sync-ai-prompts.md +0 -93
- package/.claude/settings.local.json +0 -23
- package/.github/copilot-instructions.md +0 -448
- package/.husky/post-checkout +0 -32
- package/.husky/pre-push +0 -36
- package/AGENTS.md +0 -448
- package/AI_PROMPT_SOURCE.md +0 -446
- package/CLAUDE.md +0 -448
- package/GEMINI.md +0 -448
- package/docs/kibana/crypto-way-deposit-amount-bug-analysis.md +0 -1003
- package/docs/kibana/play-providerId-error.md +0 -202
- package/docs/kibana/play-selectedWalletType.md +0 -1
- package/docs/kibana/play-selectedWalletType_2.md +0 -1
- package/docs/kibana/play-selectedWalletType_analysis.md +0 -565
- package/docs/my-claude/feat-sharon-JT-1790247240-socket/branch-transfer.md +0 -14
- package/docs/my-claude/feat-sharon-JT-1790247240-socket/cash-module-preparation.json +0 -40
- package/docs/my-claude/feat-sharon-JT-1790247240-socket/cash-module-verification.md +0 -41
- package/docs/my-claude/feat-sharon-JT-1790247240-socket/implementation-ledger.md +0 -87
- package/docs/my-claude/feat-sharon-JT-1790247240-socket/module-report.md +0 -73
- package/docs/my-claude/feat-sharon-JT-1790247240-socket/plan.md +0 -309
- package/docs/my-claude/feat-sharon-JT-1790247240-socket/test-cases.md +0 -245
- package/docs/my-claude/feat-sharon-JT-1791180540-onesignal/transfer.md +0 -9
- package/scripts/auto-version.js +0 -68
- package/scripts/auto-version.sh +0 -33
- package/scripts/branch-auto-npm-publish.js +0 -29
- package/scripts/check-version.sh +0 -36
- package/scripts/clean-tags.sh +0 -84
- package/src/util/amount.js +0 -8
- package/src/util/err998SentryExtra.js +0 -26
- package/src/util/paramStore.js +0 -139
- package/src/util/socketPolicy.js +0 -57
- package/test/auth_otp_v3.test.js +0 -323
- package/tests/websocket.test.mjs +0 -779
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
import test from 'node:test'
|
|
2
|
+
import assert from 'node:assert/strict'
|
|
3
|
+
|
|
4
|
+
import activityFactory from '../src/machine/activity/activity.js'
|
|
5
|
+
import activityCashFactory from '../src/machine/activity/activity_cash.js'
|
|
6
|
+
import signInActivityFactory from '../src/machine/activity/sign_in_activity.js'
|
|
7
|
+
import { createLocalStorageMock } from './helpers.js'
|
|
8
|
+
|
|
9
|
+
test('activity machine covers unread, guards, delays and services', async () => {
|
|
10
|
+
global.localStorage = createLocalStorageMock()
|
|
11
|
+
|
|
12
|
+
const calls = []
|
|
13
|
+
let token = 't'
|
|
14
|
+
const request = {
|
|
15
|
+
config: { appSecret: 'secret' },
|
|
16
|
+
getToken: () => token,
|
|
17
|
+
send: async (req) => {
|
|
18
|
+
calls.push(req)
|
|
19
|
+
if (req.url === 'activities/list' || req.url === 'all-activities/list') {
|
|
20
|
+
return {
|
|
21
|
+
data: [
|
|
22
|
+
{ activityNo: 1, activityType: 1, tournament: 0 },
|
|
23
|
+
{ activityNo: 2, activityType: 2, tournament: 1 },
|
|
24
|
+
{ activityNo: 4, activityType: 4, tournament: 1 },
|
|
25
|
+
],
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
if (req.url === 'payment/v2/bankWallet/promotions') return [{ promotionsNo: 'P1' }]
|
|
29
|
+
if (req.url === 'activities') return { data: { activityNo: req.params.activityNo, detail: true } }
|
|
30
|
+
return {}
|
|
31
|
+
},
|
|
32
|
+
}
|
|
33
|
+
const machine = activityFactory(request)
|
|
34
|
+
const actions = machine.options.actions
|
|
35
|
+
const guards = machine.options.guards
|
|
36
|
+
const delays = machine.options.delays
|
|
37
|
+
const services = machine.options.services
|
|
38
|
+
|
|
39
|
+
assert.deepEqual(actions.setSiteConifg.assignment(machine.initialState.context, { data: { dt: true } }), {
|
|
40
|
+
siteConfig: { dt: true },
|
|
41
|
+
})
|
|
42
|
+
assert.equal(
|
|
43
|
+
actions.setTournamentList.assignment(machine.initialState.context, {
|
|
44
|
+
data: { activityList: [{ tournament: 1 }, { tournament: 0 }, { tournament: 1 }] },
|
|
45
|
+
}).tournamentList.length,
|
|
46
|
+
2
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
localStorage.setItem('unread_1_u1', 'false')
|
|
50
|
+
const listPatch = actions.setActivityList.assignment(
|
|
51
|
+
{ ...machine.initialState.context, uidSite: 'u1' },
|
|
52
|
+
{
|
|
53
|
+
data: {
|
|
54
|
+
activityList: [
|
|
55
|
+
{ activityNo: 1, activityType: 1 },
|
|
56
|
+
{ activityNo: 2, activityType: 2 },
|
|
57
|
+
{ activityNo: 9, activityType: 9 },
|
|
58
|
+
],
|
|
59
|
+
},
|
|
60
|
+
}
|
|
61
|
+
)
|
|
62
|
+
assert.equal(listPatch.activityList[0].unread, false)
|
|
63
|
+
assert.equal(listPatch.activityList[1].unread, false)
|
|
64
|
+
assert.equal(listPatch.activityList[2].unread, true)
|
|
65
|
+
assert.deepEqual(
|
|
66
|
+
actions.setActivityList.assignment({ ...machine.initialState.context, uidSite: 'u1' }, { data: { activityList: null } }).activityList,
|
|
67
|
+
[]
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
assert.deepEqual(actions.setPromotionList.assignment(machine.initialState.context, { data: { promotionList: [{ id: 1 }] } }), {
|
|
71
|
+
promotionList: [{ id: 1 }],
|
|
72
|
+
})
|
|
73
|
+
assert.equal(
|
|
74
|
+
actions.setActivitiesDetailList.assignment(machine.initialState.context, { data: [{ data: { a: 1 } }, { data: { b: 2 } }] }).activitiesDetailList
|
|
75
|
+
.length,
|
|
76
|
+
2
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
const unreadPatched = actions.setUnread.assignment(
|
|
80
|
+
{
|
|
81
|
+
...machine.initialState.context,
|
|
82
|
+
activityList: [
|
|
83
|
+
{ activityNo: 10, unread: true },
|
|
84
|
+
{ activityNo: 11, unread: true },
|
|
85
|
+
],
|
|
86
|
+
},
|
|
87
|
+
{ data: { uidSite: 'u2', activityNo: 10, unread: false } }
|
|
88
|
+
)
|
|
89
|
+
assert.equal(unreadPatched.activityList[0].unread, false)
|
|
90
|
+
assert.equal(unreadPatched.activityList[1].unread, true)
|
|
91
|
+
assert.equal(unreadPatched.uidSite, 'u2')
|
|
92
|
+
|
|
93
|
+
assert.equal(actions.resetActivities.assignment(machine.initialState.context, {}).isPlaying, true)
|
|
94
|
+
assert.equal(actions.leaveGame.assignment({ ...machine.initialState.context, isPlaying: true }, {}).isPlaying, false)
|
|
95
|
+
|
|
96
|
+
assert.equal(guards.hasSpecifyActivities({ activityList: [{ activityType: 4 }], specifyActivities: [4] }), true)
|
|
97
|
+
assert.equal(guards.hasSpecifyActivities({ activityList: [{ activityType: 1 }], specifyActivities: [4] }), false)
|
|
98
|
+
assert.equal(guards.isInGame({ isPlaying: true }), true)
|
|
99
|
+
assert.equal(guards.isNotInGame({ isPlaying: true }), false)
|
|
100
|
+
assert.equal(delays.TIMEOUT({ tick: 3 }, {}), 30)
|
|
101
|
+
|
|
102
|
+
token = 'token'
|
|
103
|
+
const listWithPromo = await services.fetchList({ ...machine.initialState.context, isPlaying: false }, {})
|
|
104
|
+
assert.equal(listWithPromo.activityList.length, 3)
|
|
105
|
+
assert.equal(listWithPromo.promotionList.length, 1)
|
|
106
|
+
|
|
107
|
+
const listInGame = await services.fetchList({ ...machine.initialState.context, isPlaying: true }, {})
|
|
108
|
+
assert.deepEqual(listInGame.promotionList, [])
|
|
109
|
+
|
|
110
|
+
token = null
|
|
111
|
+
const listNoToken = await services.fetchList({ ...machine.initialState.context, isPlaying: false }, {})
|
|
112
|
+
assert.equal(listNoToken.activityList.length, 3)
|
|
113
|
+
assert.deepEqual(listNoToken.promotionList, [])
|
|
114
|
+
|
|
115
|
+
const originalSetTimeout = global.setTimeout
|
|
116
|
+
global.setTimeout = (fn) => {
|
|
117
|
+
fn()
|
|
118
|
+
return 0
|
|
119
|
+
}
|
|
120
|
+
const details = await services.fetchActivitiesDetail(
|
|
121
|
+
{
|
|
122
|
+
activityList: [
|
|
123
|
+
{ activityNo: 4, activityType: 4 },
|
|
124
|
+
{ activityNo: 1, activityType: 1 },
|
|
125
|
+
],
|
|
126
|
+
specifyActivities: [4],
|
|
127
|
+
},
|
|
128
|
+
{}
|
|
129
|
+
)
|
|
130
|
+
global.setTimeout = originalSetTimeout
|
|
131
|
+
assert.equal(details.length, 1)
|
|
132
|
+
assert.equal(details[0].data.activityNo, 4)
|
|
133
|
+
assert.equal(calls.length > 0, true)
|
|
134
|
+
})
|
|
135
|
+
|
|
136
|
+
test('activity_cash machine covers list/detail branches and fetch behavior', async () => {
|
|
137
|
+
global.localStorage = createLocalStorageMock()
|
|
138
|
+
const calls = []
|
|
139
|
+
let token = 't'
|
|
140
|
+
const request = {
|
|
141
|
+
config: { appSecret: 'secret' },
|
|
142
|
+
getToken: () => token,
|
|
143
|
+
send: async (req) => {
|
|
144
|
+
calls.push(req)
|
|
145
|
+
if (req.url === 'activities/list' || req.url === 'all-activities/list') {
|
|
146
|
+
return {
|
|
147
|
+
data: [
|
|
148
|
+
{ activityNo: 4, activityType: 4, tournament: 1 },
|
|
149
|
+
{ activityNo: 1, activityType: 1, tournament: 0 },
|
|
150
|
+
],
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
if (req.url === 'payment/v2/bankWallet/promotions') return [{ id: 'promo' }]
|
|
154
|
+
if (req.url === 'activities') return { data: { activityNo: req.params.activityNo } }
|
|
155
|
+
return {}
|
|
156
|
+
},
|
|
157
|
+
}
|
|
158
|
+
const machine = activityCashFactory(request)
|
|
159
|
+
const actions = machine.options.actions
|
|
160
|
+
const guards = machine.options.guards
|
|
161
|
+
const delays = machine.options.delays
|
|
162
|
+
const services = machine.options.services
|
|
163
|
+
|
|
164
|
+
localStorage.setItem('unread_1_u3', 'false')
|
|
165
|
+
const listPatch = actions.setActivityList.assignment(
|
|
166
|
+
{ ...machine.initialState.context, uidSite: 'u3' },
|
|
167
|
+
{
|
|
168
|
+
data: {
|
|
169
|
+
activityList: [
|
|
170
|
+
{ activityNo: 1, activityType: 1 },
|
|
171
|
+
{ activityNo: 2, activityType: 2 },
|
|
172
|
+
{ activityNo: 3, activityType: 3 },
|
|
173
|
+
],
|
|
174
|
+
},
|
|
175
|
+
}
|
|
176
|
+
)
|
|
177
|
+
assert.equal(listPatch.activityList[0].unread, false)
|
|
178
|
+
assert.equal(listPatch.activityList[1].unread, false)
|
|
179
|
+
assert.equal(listPatch.activityList[2].unread, true)
|
|
180
|
+
assert.deepEqual(
|
|
181
|
+
actions.setActivityList.assignment({ ...machine.initialState.context, uidSite: 'u3' }, { data: { activityList: null } }).activityList,
|
|
182
|
+
[]
|
|
183
|
+
)
|
|
184
|
+
|
|
185
|
+
assert.equal(
|
|
186
|
+
actions.setTournamentList.assignment(machine.initialState.context, { data: { activityList: [{ tournament: 1 }, { tournament: 0 }] } })
|
|
187
|
+
.tournamentList.length,
|
|
188
|
+
1
|
|
189
|
+
)
|
|
190
|
+
assert.deepEqual(actions.setPromotionList.assignment(machine.initialState.context, { data: { promotionList: [{ id: 1 }] } }), {
|
|
191
|
+
promotionList: [{ id: 1 }],
|
|
192
|
+
})
|
|
193
|
+
assert.equal(
|
|
194
|
+
actions.setUnread.assignment(
|
|
195
|
+
{
|
|
196
|
+
...machine.initialState.context,
|
|
197
|
+
activityList: [
|
|
198
|
+
{ activityNo: 9, unread: true },
|
|
199
|
+
{ activityNo: 10, unread: true },
|
|
200
|
+
],
|
|
201
|
+
},
|
|
202
|
+
{ data: { uidSite: 'u4', activityNo: 9, unread: false } }
|
|
203
|
+
).activityList[0].unread,
|
|
204
|
+
false
|
|
205
|
+
)
|
|
206
|
+
assert.equal(
|
|
207
|
+
actions.setUnread.assignment(
|
|
208
|
+
{
|
|
209
|
+
...machine.initialState.context,
|
|
210
|
+
activityList: [
|
|
211
|
+
{ activityNo: 9, unread: true },
|
|
212
|
+
{ activityNo: 10, unread: true },
|
|
213
|
+
],
|
|
214
|
+
},
|
|
215
|
+
{ data: { uidSite: 'u4', activityNo: 9, unread: false } }
|
|
216
|
+
).activityList[1].unread,
|
|
217
|
+
true
|
|
218
|
+
)
|
|
219
|
+
assert.equal(actions.setActivityDetailList.assignment(machine.initialState.context, { data: [{ data: { x: 1 } }] }).activityDetailList.length, 1)
|
|
220
|
+
assert.equal(actions.resetActivities.assignment(machine.initialState.context, {}).isPlaying, true)
|
|
221
|
+
assert.equal(actions.leaveGame.assignment({ ...machine.initialState.context, isPlaying: true }, {}).isPlaying, false)
|
|
222
|
+
|
|
223
|
+
assert.equal(guards.needFetchingDetail({ activityList: [{ activityType: 4 }], detailNeededActivityTypes: [4] }), true)
|
|
224
|
+
assert.equal(guards.needFetchingDetail({ activityList: [{ activityType: 1 }], detailNeededActivityTypes: [4] }), false)
|
|
225
|
+
assert.equal(guards.isInGame({ isPlaying: true }), true)
|
|
226
|
+
assert.equal(guards.isNotInGame({ isPlaying: false }), true)
|
|
227
|
+
assert.equal(delays.TIMEOUT({ tick: 2 }, {}), 20)
|
|
228
|
+
|
|
229
|
+
token = 'token'
|
|
230
|
+
const withToken = await services.fetchList(machine.initialState.context, {})
|
|
231
|
+
assert.equal(withToken.promotionList.length, 1)
|
|
232
|
+
token = null
|
|
233
|
+
const withoutToken = await services.fetchList(machine.initialState.context, {})
|
|
234
|
+
assert.deepEqual(withoutToken.promotionList, [])
|
|
235
|
+
|
|
236
|
+
const originalSetTimeout = global.setTimeout
|
|
237
|
+
global.setTimeout = (fn) => {
|
|
238
|
+
fn()
|
|
239
|
+
return 0
|
|
240
|
+
}
|
|
241
|
+
token = 'token'
|
|
242
|
+
const detailWithToken = await services.fetchActivityDetailList(
|
|
243
|
+
{
|
|
244
|
+
activityList: [
|
|
245
|
+
{ activityNo: 4, activityType: 4 },
|
|
246
|
+
{ activityNo: 1, activityType: 1 },
|
|
247
|
+
],
|
|
248
|
+
detailNeededActivityTypes: [4],
|
|
249
|
+
},
|
|
250
|
+
{}
|
|
251
|
+
)
|
|
252
|
+
token = null
|
|
253
|
+
const detailWithoutToken = await services.fetchActivityDetailList(
|
|
254
|
+
{ activityList: [{ activityNo: 4, activityType: 4 }], detailNeededActivityTypes: [4] },
|
|
255
|
+
{}
|
|
256
|
+
)
|
|
257
|
+
global.setTimeout = originalSetTimeout
|
|
258
|
+
assert.equal(detailWithToken.length, 1)
|
|
259
|
+
assert.deepEqual(detailWithoutToken, [])
|
|
260
|
+
assert.equal(calls.length > 0, true)
|
|
261
|
+
})
|
|
262
|
+
|
|
263
|
+
test('sign_in_activity actions/guards/services cover receive and progress branches', async () => {
|
|
264
|
+
const calls = []
|
|
265
|
+
const request = {
|
|
266
|
+
config: { appSecret: 'secret' },
|
|
267
|
+
send: async (req) => {
|
|
268
|
+
calls.push(req)
|
|
269
|
+
if (req.url === 'activities') {
|
|
270
|
+
return {
|
|
271
|
+
data: {
|
|
272
|
+
activityNo: 'A1',
|
|
273
|
+
receiveNo: '2',
|
|
274
|
+
receiveStatus: 2,
|
|
275
|
+
achieve: true,
|
|
276
|
+
awards: [{ id: 1 }],
|
|
277
|
+
target: '100',
|
|
278
|
+
turnover: '75',
|
|
279
|
+
dayOfTheWeek: 5,
|
|
280
|
+
policy: 'SIGN_IN',
|
|
281
|
+
},
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
if (req.url === 'activities/rewards') return { data: { ok: true } }
|
|
285
|
+
return {}
|
|
286
|
+
},
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
const machine = signInActivityFactory(request, { activityNo: 'A1' })
|
|
290
|
+
const actions = machine.options.actions
|
|
291
|
+
const guards = machine.options.guards
|
|
292
|
+
const services = machine.options.services
|
|
293
|
+
const receivedEntry = machine.config.states.received.entry.assignment
|
|
294
|
+
|
|
295
|
+
assert.equal(actions.setActivityNo.assignment(machine.initialState.context, { data: 'A2' }).activityNo, 'A2')
|
|
296
|
+
const detail = actions.setActivityDetail.assignment(machine.initialState.context, {
|
|
297
|
+
data: {
|
|
298
|
+
receiveNo: 1,
|
|
299
|
+
receiveStatus: 2,
|
|
300
|
+
achieve: true,
|
|
301
|
+
awards: [{ id: 1 }],
|
|
302
|
+
target: '100',
|
|
303
|
+
turnover: '26',
|
|
304
|
+
dayOfTheWeek: 3,
|
|
305
|
+
policy: 'SIGN_IN',
|
|
306
|
+
},
|
|
307
|
+
})
|
|
308
|
+
assert.equal(detail.receiveStatus, 2)
|
|
309
|
+
assert.equal(detail.rewardType, 'SIGN_IN')
|
|
310
|
+
|
|
311
|
+
assert.equal(actions.setProgressStatus.assignment({ ...machine.initialState.context, turnover: '0', target: '100' }, {}).progressStatus, 0)
|
|
312
|
+
assert.equal(actions.setProgressStatus.assignment({ ...machine.initialState.context, turnover: '25', target: '100' }, {}).progressStatus, 25)
|
|
313
|
+
assert.equal(actions.setProgressStatus.assignment({ ...machine.initialState.context, turnover: '50', target: '100' }, {}).progressStatus, 50)
|
|
314
|
+
assert.equal(actions.setProgressStatus.assignment({ ...machine.initialState.context, turnover: '75', target: '100' }, {}).progressStatus, 75)
|
|
315
|
+
assert.equal(actions.setProgressStatus.assignment({ ...machine.initialState.context, turnover: '100', target: '100' }, {}).progressStatus, 100)
|
|
316
|
+
assert.equal(
|
|
317
|
+
actions.setProgressStatus.assignment({ ...machine.initialState.context, turnover: undefined, target: undefined }, {}).progressStatus,
|
|
318
|
+
0
|
|
319
|
+
)
|
|
320
|
+
assert.equal(receivedEntry(machine.initialState.context, {}).progressStatus, 100)
|
|
321
|
+
|
|
322
|
+
let count = 0
|
|
323
|
+
const callbackPatch = actions.setCallback.assignment(machine.initialState.context, { data: { callback: () => count++ } })
|
|
324
|
+
actions.doCallback({ callback: callbackPatch.callback }, {})
|
|
325
|
+
assert.equal(count, 1)
|
|
326
|
+
|
|
327
|
+
assert.equal(guards.isReceived({ receiveStatus: 1 }), true)
|
|
328
|
+
assert.equal(guards.isReceiveable({ receiveStatus: 2 }), true)
|
|
329
|
+
|
|
330
|
+
const fetched = await services.fetchActivityDetail({ activityNo: 'A1' }, {})
|
|
331
|
+
assert.equal(fetched.activityNo, 'A1')
|
|
332
|
+
await services.receiveReward({ activityNo: 'A1', receiveNo: '2' }, {})
|
|
333
|
+
await services.receiveReward({ activityNo: 'A1', receiveNo: '0' }, {})
|
|
334
|
+
const rewardCalls = calls.filter((item) => item.url === 'activities/rewards')
|
|
335
|
+
assert.equal(rewardCalls[0].params.receiveNo, 2)
|
|
336
|
+
assert.equal(rewardCalls[1].params.receiveNo, undefined)
|
|
337
|
+
})
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
import test from 'node:test'
|
|
2
|
+
import assert from 'node:assert/strict'
|
|
3
|
+
|
|
4
|
+
import friendInviteFriendsFactory from '../src/machine/activity/friend_invite_friends_activity.js'
|
|
5
|
+
import instantRebateFactory from '../src/machine/activity/instant_rebate_activity.js'
|
|
6
|
+
import diamondShopFcFactory from '../src/machine/activity/diamond_shop_activity_fc.js'
|
|
7
|
+
|
|
8
|
+
test('friend_invite_friends_activity actions/guards/services cover list merge and bind flow', async () => {
|
|
9
|
+
const calls = []
|
|
10
|
+
const request = {
|
|
11
|
+
config: { appSecret: 'secret' },
|
|
12
|
+
send: async (req) => {
|
|
13
|
+
calls.push(req)
|
|
14
|
+
if (req.url === 'friends') {
|
|
15
|
+
if (req.method === 'get') return { friendCode: 'F001', bindFriendLimitDaysAfterRegistered: 7 }
|
|
16
|
+
return { ok: true }
|
|
17
|
+
}
|
|
18
|
+
if (req.url === 'friends/home') return { commission: 11, downLine: 22, activeDownLine: 3 }
|
|
19
|
+
if (req.url === 'friends/dashboard') return { levelTable: [{ level: 1 }], pastTable: [{ level: 0 }] }
|
|
20
|
+
if (req.url === 'activities/sentAward') return { data: { awarded: true } }
|
|
21
|
+
if (req.url === 'friends/dashboard/list') {
|
|
22
|
+
if (req.params.page === 1) return { data: [{ uid: 'a' }], page: { current: 1, total: 2 } }
|
|
23
|
+
return { data: [{ uid: 'b' }], page: { current: 2, total: 2 } }
|
|
24
|
+
}
|
|
25
|
+
if (req.url === 'friends/reward-list') {
|
|
26
|
+
if (req.params.page === 1)
|
|
27
|
+
return { data: { list: [{ id: 1 }], rewardsDetail: { receivedCounts: 1, allDownLineCounts: 9 }, page: { current: 1, total: 2 } } }
|
|
28
|
+
return { data: { list: [{ id: 2 }], rewardsDetail: { receivedCounts: 2, allDownLineCounts: 10 }, page: { current: 2, total: 2 } } }
|
|
29
|
+
}
|
|
30
|
+
return {}
|
|
31
|
+
},
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const machine = friendInviteFriendsFactory(request)
|
|
35
|
+
const { actions, guards, services } = machine.options
|
|
36
|
+
|
|
37
|
+
assert.equal(
|
|
38
|
+
actions.setFriendsCode.assignment(machine.initialState.context, { data: { friendCode: 'FC', bindFriendLimitDaysAfterRegistered: 5 } }).friendCode,
|
|
39
|
+
'FC'
|
|
40
|
+
)
|
|
41
|
+
assert.equal(actions.setFriendsCode.assignment(machine.initialState.context, { data: null }).friendCode, '')
|
|
42
|
+
|
|
43
|
+
const initialData = actions.setInitialData.assignment(machine.initialState.context, {
|
|
44
|
+
data: [
|
|
45
|
+
{ commission: 1, downLine: 2, activeDownLine: 3 },
|
|
46
|
+
{ levelTable: [{ level: 1 }], pastTable: [{ level: 0 }] },
|
|
47
|
+
],
|
|
48
|
+
})
|
|
49
|
+
assert.equal(initialData.commission, 1)
|
|
50
|
+
assert.equal(initialData.levelTable.length, 1)
|
|
51
|
+
|
|
52
|
+
assert.equal(actions.setBindingCode.assignment(machine.initialState.context, { data: { bindingCode: 'BC' } }).bindingCode, 'BC')
|
|
53
|
+
assert.equal(actions.setActivityNo.assignment(machine.initialState.context, { data: { activityNo: 'A1' } }).activityNo, 'A1')
|
|
54
|
+
assert.equal(actions.setUidSite.assignment(machine.initialState.context, { data: { uidSite: 'U1' } }).uidSite, 'U1')
|
|
55
|
+
assert.equal(actions.setLevelSearch.assignment(machine.initialState.context, { data: { level: 9 } }).currentLevel, 9)
|
|
56
|
+
assert.equal(actions.setTypeSearch.assignment(machine.initialState.context, { data: { type: 'RECEIVED' } }).currentType, 'RECEIVED')
|
|
57
|
+
assert.equal(actions.reset.assignment(machine.initialState.context, {}).page, 1)
|
|
58
|
+
assert.equal(actions.resetList.assignment(machine.initialState.context, {}).listPage, 1)
|
|
59
|
+
assert.equal(actions.setPage.assignment({ ...machine.initialState.context, page: 2 }, {}).page, 3)
|
|
60
|
+
assert.equal(actions.setListPage.assignment({ ...machine.initialState.context, listPage: 4 }, {}).listPage, 5)
|
|
61
|
+
assert.equal(actions.setLevelDownLineList.assignment(machine.initialState.context, { data: { x: 1 } }).levelDownLine.x, 1)
|
|
62
|
+
|
|
63
|
+
const friendListPatch = actions.setFriendsList.assignment(machine.initialState.context, {
|
|
64
|
+
data: { list: [{ id: 1 }], rewardsDetail: { receivedCounts: 3, allDownLineCounts: 7 } },
|
|
65
|
+
})
|
|
66
|
+
assert.equal(friendListPatch.receivedCounts, 3)
|
|
67
|
+
assert.equal(friendListPatch.allDownLineCounts, 7)
|
|
68
|
+
|
|
69
|
+
assert.equal(guards.isNotEnd({ levelDownLine: { page: { current: 1, total: 2 } } }), true)
|
|
70
|
+
assert.equal(guards.isListNotEnd({ friendsList: { page: { current: 2, total: 2 } } }), false)
|
|
71
|
+
assert.equal(guards.isFriendsEnable({ friendsEnable: true }), true)
|
|
72
|
+
|
|
73
|
+
const code = await services.fetchFriendCode({}, {})
|
|
74
|
+
assert.equal(code.friendCode, 'F001')
|
|
75
|
+
|
|
76
|
+
const data = await services.fetchFriendsData({}, {})
|
|
77
|
+
assert.equal(data[0].commission, 11)
|
|
78
|
+
assert.equal(data[1].levelTable.length, 1)
|
|
79
|
+
|
|
80
|
+
await services.postFriends({ bindingCode: 'BINDX' }, {})
|
|
81
|
+
const award = await services.awardPrize({ activityNo: 'A1', uidSite: 'U1', bindingCode: 'BINDX' }, {})
|
|
82
|
+
assert.equal(award.awarded, true)
|
|
83
|
+
|
|
84
|
+
const levelPage1 = await services.fetchLevelDownLineList({ currentLevel: 1, page: 1, levelDownLine: {} }, {})
|
|
85
|
+
const levelPage2 = await services.fetchLevelDownLineList({ currentLevel: 1, page: 2, levelDownLine: levelPage1 }, {})
|
|
86
|
+
assert.equal(levelPage1.data.length, 1)
|
|
87
|
+
assert.equal(levelPage2.data.length, 2)
|
|
88
|
+
|
|
89
|
+
const rewardsPage1 = await services.fetchFriendsList({ currentType: 'ALL', listPage: 1, friendsList: {} }, {})
|
|
90
|
+
const rewardsPage2 = await services.fetchFriendsList({ currentType: 'ALL', listPage: 2, friendsList: rewardsPage1 }, {})
|
|
91
|
+
assert.equal(rewardsPage1.list.length, 1)
|
|
92
|
+
assert.equal(rewardsPage2.list.length, 2)
|
|
93
|
+
|
|
94
|
+
assert.equal(
|
|
95
|
+
calls.some((req) => req.url === 'activities/sentAward'),
|
|
96
|
+
true
|
|
97
|
+
)
|
|
98
|
+
})
|
|
99
|
+
|
|
100
|
+
test('instant_rebate_activity actions/guards/services cover estimate and claim status', async () => {
|
|
101
|
+
const request = {
|
|
102
|
+
send: async (req) => {
|
|
103
|
+
if (req.url === 'activities/rebate/estimate') {
|
|
104
|
+
return {
|
|
105
|
+
data: {
|
|
106
|
+
rebateCycle: 'daily',
|
|
107
|
+
showColletButton: true,
|
|
108
|
+
estimateStartTime: 10,
|
|
109
|
+
estimateEndTime: 20,
|
|
110
|
+
lastCollectTime: 9,
|
|
111
|
+
collectAvailable: true,
|
|
112
|
+
cumulativeValidTurnover: '1,000',
|
|
113
|
+
weekCumulativeValidTurnover: '2,000',
|
|
114
|
+
cumulativeRebateAmount: '100',
|
|
115
|
+
weekCumulativeRebateAmount: '200',
|
|
116
|
+
actualRebateAmount: '150',
|
|
117
|
+
rewardType: 'cash',
|
|
118
|
+
singleMinimumAmountReceive: '100',
|
|
119
|
+
dailyMaximumAmountReceive: '999',
|
|
120
|
+
remainingCount: 1,
|
|
121
|
+
dailyRedemptionLimit: 5,
|
|
122
|
+
reachedAmountLimit: false,
|
|
123
|
+
rebateDistributionTime: 111,
|
|
124
|
+
},
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
if (req.url === 'activities/rebate/collect') return { data: { result: 'success', amount: '150' } }
|
|
128
|
+
return { data: {} }
|
|
129
|
+
},
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
const machine = instantRebateFactory(request)
|
|
133
|
+
const { actions, guards, services } = machine.options
|
|
134
|
+
|
|
135
|
+
assert.equal(actions.setActivityNo.assignment(machine.initialState.context, { data: 'A1' }).activityNo, 'A1')
|
|
136
|
+
|
|
137
|
+
const estimatePatch = actions.setEstimateResult.assignment(machine.initialState.context, {
|
|
138
|
+
data: {
|
|
139
|
+
collectAvailable: false,
|
|
140
|
+
actualRebateAmount: '80',
|
|
141
|
+
singleMinimumAmountReceive: '100',
|
|
142
|
+
remainingCount: 5,
|
|
143
|
+
dailyRedemptionLimit: 5,
|
|
144
|
+
reachedAmountLimit: true,
|
|
145
|
+
},
|
|
146
|
+
})
|
|
147
|
+
assert.equal(estimatePatch.collectAvailable, false)
|
|
148
|
+
assert.equal(estimatePatch.reachedAmountLimit, true)
|
|
149
|
+
|
|
150
|
+
const claimPatch = actions.setClaimesult.assignment(machine.initialState.context, { data: { result: 'success' } })
|
|
151
|
+
assert.equal(claimPatch.claimResultData.result, 'success')
|
|
152
|
+
|
|
153
|
+
assert.equal(guards.isClaimAmountLimitReached({ collectAvailable: false, reachedAmountLimit: true }), true)
|
|
154
|
+
assert.equal(guards.isClaimExhausted({ collectAvailable: false, remainingCount: '5', dailyRedemptionLimit: '5' }), true)
|
|
155
|
+
assert.equal(guards.isInsufficientAmount({ collectAvailable: false, singleMinimumAmountReceive: '1,000', actualRebateAmount: '999' }), true)
|
|
156
|
+
assert.equal(
|
|
157
|
+
guards.isClaimEnable({
|
|
158
|
+
collectAvailable: true,
|
|
159
|
+
remainingCount: 1,
|
|
160
|
+
dailyRedemptionLimit: 2,
|
|
161
|
+
actualRebateAmount: '1,000',
|
|
162
|
+
singleMinimumAmountReceive: '999',
|
|
163
|
+
}),
|
|
164
|
+
true
|
|
165
|
+
)
|
|
166
|
+
assert.equal(guards.isClaimSuccess({ claimResultData: { result: 'success' } }), true)
|
|
167
|
+
|
|
168
|
+
const estimated = await services.estimate({}, {})
|
|
169
|
+
assert.equal(estimated.rebateCycle, 'daily')
|
|
170
|
+
const claimed = await services.claimRebateAmount({}, {})
|
|
171
|
+
assert.equal(claimed.result, 'success')
|
|
172
|
+
})
|
|
173
|
+
|
|
174
|
+
test('diamond_shop_activity_fc actions/guards/services cover loading, exchange and collect branches', async () => {
|
|
175
|
+
const calls = []
|
|
176
|
+
const request = {
|
|
177
|
+
config: { appSecret: 'secret' },
|
|
178
|
+
send: async (req) => {
|
|
179
|
+
calls.push(req)
|
|
180
|
+
if (req.url === 'activities/list') {
|
|
181
|
+
return {
|
|
182
|
+
data: [
|
|
183
|
+
{ activityType: 90, activityNo: 'X' },
|
|
184
|
+
{ activityType: 91, activityNo: 'A91' },
|
|
185
|
+
],
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
if (req.url === 'activities') {
|
|
189
|
+
return { data: { activityNo: 'A91', awards: [{ award: 10, points: 3 }], unclaimedReward: [{ id: 1 }] } }
|
|
190
|
+
}
|
|
191
|
+
if (req.url === 'activities/exchange') return { ok: true }
|
|
192
|
+
if (req.url === 'activities/collect') return { ok: true }
|
|
193
|
+
return {}
|
|
194
|
+
},
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
const machine = diamondShopFcFactory(request)
|
|
198
|
+
const { actions, guards, services } = machine.options
|
|
199
|
+
|
|
200
|
+
assert.equal(actions.setActivityNo.assignment(machine.initialState.context, { data: 'A100' }).activityNo, 'A100')
|
|
201
|
+
|
|
202
|
+
const listPatch = actions.setDiamondShopActivities.assignment(machine.initialState.context, {
|
|
203
|
+
data: [
|
|
204
|
+
{ activityType: 90, activityNo: 'X' },
|
|
205
|
+
{ activityType: 91, activityNo: 'A91' },
|
|
206
|
+
],
|
|
207
|
+
})
|
|
208
|
+
assert.equal(listPatch.rankActivities.length, 1)
|
|
209
|
+
assert.equal(listPatch.activityNo, 'A91')
|
|
210
|
+
|
|
211
|
+
assert.equal(actions.setActivityDetail.assignment(machine.initialState.context, { data: { a: 1 } }).activityDetail.a, 1)
|
|
212
|
+
assert.equal(actions.setAwardList.assignment(machine.initialState.context, { data: { awards: [{ id: 1 }] } }).awardList.length, 1)
|
|
213
|
+
|
|
214
|
+
const added = actions.addProduct.assignment(
|
|
215
|
+
{ ...machine.initialState.context, exchangeList: [{ award: 1, points: 2 }] },
|
|
216
|
+
{ data: { award: 10, points: 5 } }
|
|
217
|
+
)
|
|
218
|
+
assert.equal(added.exchangeList.length, 2)
|
|
219
|
+
assert.equal(actions.clearCart.assignment({ ...machine.initialState.context, exchangeList: [{ award: 1, points: 2 }] }, {}).exchangeList.length, 0)
|
|
220
|
+
|
|
221
|
+
const counted = actions.count.assignment(
|
|
222
|
+
{
|
|
223
|
+
...machine.initialState.context,
|
|
224
|
+
exchangeList: [
|
|
225
|
+
{ award: 2, points: 3 },
|
|
226
|
+
{ award: 5, points: 7 },
|
|
227
|
+
],
|
|
228
|
+
},
|
|
229
|
+
{}
|
|
230
|
+
)
|
|
231
|
+
assert.equal(counted.exchangeAward, 7)
|
|
232
|
+
assert.equal(counted.exchangePoint, 10)
|
|
233
|
+
|
|
234
|
+
assert.equal(guards.hasUnclaimedReward({ activityDetail: { unclaimedReward: [{ id: 1 }] } }), true)
|
|
235
|
+
assert.equal(guards.isExchangeable({ exchangeList: [] }), false)
|
|
236
|
+
assert.equal(guards.hasActivityNo({ activityNo: 'A91' }), true)
|
|
237
|
+
|
|
238
|
+
const activities = await services.fetchActivityList({}, {})
|
|
239
|
+
assert.equal(activities.length, 2)
|
|
240
|
+
const detail = await services.fetchActivityDetail({ activityNo: 'A91' }, {})
|
|
241
|
+
assert.equal(detail.activityNo, 'A91')
|
|
242
|
+
|
|
243
|
+
const exchangeRes = await services.exchange({ activityNo: 'A91', exchangeList: [{ award: 10 }, { award: 20 }] }, {})
|
|
244
|
+
assert.equal(exchangeRes.length, 2)
|
|
245
|
+
await services.collect({}, {})
|
|
246
|
+
|
|
247
|
+
assert.equal(calls.filter((req) => req.url === 'activities/exchange').length, 2)
|
|
248
|
+
assert.equal(
|
|
249
|
+
calls.some((req) => req.url === 'activities/collect'),
|
|
250
|
+
true
|
|
251
|
+
)
|
|
252
|
+
})
|