import assert from 'node:assert/strict'
import { readFileSync } from 'node:fs'
import { fileURLToPath } from 'node:url'
const policiesViewPath = fileURLToPath(new URL('../src/views/PoliciesView.vue', import.meta.url))
const policiesView = readFileSync(policiesViewPath, 'utf8')
function testIngestTimeUsesDedicatedColumn() {
assert.match(
policiesView,
/
状态<\/th>\s* | 归纳时间<\/th>\s* | 上传人<\/th>/,
'知识库文件表需要在状态和上传人之间单独展示归纳时间列'
)
assert.match(
policiesView,
/ | \s* \s*]*>\{\{ doc\.state \}\}<\/span>\s*<\/div>\s*<\/td>\s* | \{\{ doc\.ingestTime \|\| '—' \}\}<\/td>/,
'状态列只展示状态标签,归纳时间需要放到独立单元格'
)
assert.doesNotMatch(
policiesView,
/class="state-time"|归纳时间:\{\{ doc\.ingestTime \}\}/,
'状态单元格下面不应再显示归纳时间'
)
assert.doesNotMatch(policiesView, /colspan="7"/)
assert.match(policiesView, /colspan="8"/)
}
function run() {
testIngestTimeUsesDedicatedColumn()
console.log('policies view table tests passed')
}
run()
|