31 lines
1.3 KiB
TypeScript
31 lines
1.3 KiB
TypeScript
import assert from 'node:assert/strict'
|
|
import { readFileSync } from 'node:fs'
|
|
import { fileURLToPath } from 'node:url'
|
|
import test from 'node:test'
|
|
|
|
function readPanelSource() {
|
|
return readFileSync(
|
|
fileURLToPath(new URL('../src/pages/admin/panels/ConsignmentConfigPanel.tsx', import.meta.url)),
|
|
'utf8',
|
|
).replace(/\r\n/g, '\n')
|
|
}
|
|
|
|
test('自动匹配:手动等待与超时策略在 auto 下禁用并给出说明', () => {
|
|
const source = readPanelSource()
|
|
assert.ok(source.includes('label="手动匹配等待(分钟)"'), '等待时长文案必须明确只作用于手动匹配')
|
|
assert.ok(source.includes('label="超时后回大厅"'), '必须提供超时回大厅开关')
|
|
assert.ok(
|
|
source.includes('自动匹配在发布时立即匹配,未命中直接进大厅,不使用等待窗口'),
|
|
'auto 模式必须说明不使用等待窗口',
|
|
)
|
|
assert.ok(
|
|
source.includes('关闭后超时重新匹配(最多 3 次),仍未命中回大厅'),
|
|
'关闭回大厅时必须说明重试上限',
|
|
)
|
|
assert.ok(
|
|
(source.match(/disabled=\{matchingMode === 'auto'\}/g) || []).length >= 2,
|
|
'等待时长与超时策略在 auto 下都必须禁用',
|
|
)
|
|
assert.ok(!source.includes('label="内部匹配等待(分钟)"'), '旧文案必须移除')
|
|
})
|