orderPromptConfirm.service.test.mjs
1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import { describe, it } from 'node:test'
import assert from 'node:assert/strict'
describe('orderPromptConfirm.helpers', async () => {
const {
resolveOrderPromptPaymentMethod,
shouldOpenRecordingOrderPopup,
isInvalidDjQrOnlySelection
} = await import('../tabIndex/services/orderPromptConfirm.helpers.js')
it('resolveOrderPromptPaymentMethod', () => {
assert.equal(resolveOrderPromptPaymentMethod({ payFlag: 1 }), 1)
assert.equal(
resolveOrderPromptPaymentMethod({ payFlag: 2, payType: '5' }),
'5'
)
assert.equal(
resolveOrderPromptPaymentMethod({ payFlag: 2, payType: 3 }),
3
)
})
it('shouldOpenRecordingOrderPopup only for dj qr', () => {
assert.equal(shouldOpenRecordingOrderPopup({ payFlag: 1 }), false)
assert.equal(
shouldOpenRecordingOrderPopup({ payFlag: 2, payType: 3 }),
false
)
assert.equal(
shouldOpenRecordingOrderPopup({ payFlag: 2, payType: '5' }),
true
)
})
it('isInvalidDjQrOnlySelection', () => {
assert.equal(isInvalidDjQrOnlySelection({ payType: 3 }, true), true)
assert.equal(isInvalidDjQrOnlySelection({ payType: '5' }, true), false)
assert.equal(isInvalidDjQrOnlySelection({ payType: 3 }, false), false)
})
})