Files
pda-uniapp/tests/production-ui.test.mjs
T

26 lines
1.1 KiB
JavaScript

import test from 'node:test'
import assert from 'node:assert/strict'
import { readFile } from 'node:fs/promises'
const read = (path) => readFile(new URL(path, import.meta.url), 'utf8')
test('picking task list exposes only operator-facing production information', async () => {
const [tasks, adapter] = await Promise.all([
read('../pages/tasks/tasks.vue'),
read('../api/pda-loading.js')
])
assert.match(tasks, /共 \$\{tasks\.length\} 个待处理任务/)
assert.match(tasks, /\{\{ businessReference\(task\) \}\}/)
assert.match(tasks, /displayBusinessValue\(task\.warehouseName, '未关联'\)/)
assert.doesNotMatch(tasks, /接口返回|当前接口|apiEnvironment|rawTaskCount|账号:|未命名订单|缺少仓库信息|服务端就绪校验|console\.info/)
assert.doesNotMatch(adapter, /业务单号待同步/)
})
test('production login contains no built-in account or password', async () => {
const login = await read('../pages/login/login.vue')
assert.match(login, /form: \{ userId: '', password: '' \}/)
assert.doesNotMatch(login, /platform_admin|ChangeMe123!/)
})