field-options-popup.test.mjs
1.6 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
/**
* field-options-popup — 弹框打开是否 bypass 缓存
*/
import { describe, it } from 'node:test'
import assert from 'node:assert/strict'
import { createRequire } from 'node:module'
const require = createRequire(import.meta.url)
const {
isRemoteFieldOptionsKey,
shouldRefreshOptionsOnPopup,
isEmployeeListPickerSearchable
} = require('../utils/field-options-popup.js')
describe('field-options-popup', () => {
it('IT-FIELD-OPT-008: shouldRefreshOptionsOnPopup for remote select keys', () => {
assert.equal(shouldRefreshOptionsOnPopup({ optionsKey: 'orderList' }), true)
assert.equal(shouldRefreshOptionsOnPopup({ optionsKey: 'storeStaffList' }), true)
assert.equal(shouldRefreshOptionsOnPopup({ optionsKey: '4sStaffList' }), true)
assert.equal(shouldRefreshOptionsOnPopup({ optionsKey: 'unknownKey' }), false)
assert.equal(shouldRefreshOptionsOnPopup({}), false)
})
it('IT-FIELD-OPT-008c: isEmployeeListPickerSearchable for staff list keys', () => {
assert.equal(isEmployeeListPickerSearchable('storeStaffList'), true)
assert.equal(isEmployeeListPickerSearchable('4sStaffList'), true)
assert.equal(isEmployeeListPickerSearchable('orderList'), false)
assert.equal(isEmployeeListPickerSearchable(''), false)
})
it("IT-FIELD-OPT-008d: optionsKey 'options' keeps template options local", () => {
assert.equal(isRemoteFieldOptionsKey('orderList'), true)
assert.equal(isRemoteFieldOptionsKey('storeStaffList'), true)
assert.equal(isRemoteFieldOptionsKey('4sStaffList'), true)
assert.equal(isRemoteFieldOptionsKey('options'), false)
assert.equal(isRemoteFieldOptionsKey('unknownKey'), false)
})
})