lowPriceSubmitNavigation.helpers.test.mjs
1.18 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
import assert from 'node:assert/strict'
import { describe, it } from 'node:test'
import {
buildPendingLowPriceListPatch,
isLowPriceListPage,
isLowPriceSubmit
} from '../services/lowPriceSubmitNavigation.helpers.js'
describe('low-price submit navigation', () => {
it('builds the pending-tab list state after a low-price submit', () => {
assert.deepEqual(buildPendingLowPriceListPatch(), {
activeIndex: 1,
tabIndex: 1,
keyword: '',
searchObj: {}
})
})
it('branches only for explicit low-price orders', () => {
assert.equal(isLowPriceSubmit({ lowPriceFlag: 1 }), true)
assert.equal(isLowPriceSubmit({ lowPriceFlag: '1' }), true)
assert.equal(isLowPriceSubmit({ lowPriceFlag: 0 }), false)
})
it('recognizes only the low-price order list as a safe back target', () => {
assert.equal(
isLowPriceListPage({ __route__: 'pages/tabWorkOrder/pages/index/index' }),
true
)
assert.equal(
isLowPriceListPage({ route: 'pages/tabWorkOrder/pages/index/index' }),
true
)
assert.equal(isLowPriceListPage({ __route__: 'pages/tab/workspace/workspace' }), false)
assert.equal(isLowPriceListPage(undefined), false)
})
})