后端新增规则资产版本管理和规则文件 CRUD 接口,优化风险 规则生成模板执行和员工数据模型字段,知识库 RAG 增强本 地回退和文档提取能力,清理旧风险规则文件统一由生成引擎 管理,前端审计页面增加运行时调试面板和规则资产编辑交互, 补充单元测试覆盖。
34 lines
997 B
JavaScript
34 lines
997 B
JavaScript
import assert from 'node:assert/strict'
|
|
import test from 'node:test'
|
|
|
|
import {
|
|
formatDocumentDurationSince,
|
|
resolveDocumentStayTimeDisplay
|
|
} from '../src/utils/documentCenterTime.js'
|
|
|
|
test('document center stay time uses current workflow step stay label first', () => {
|
|
const label = resolveDocumentStayTimeDisplay({
|
|
progressSteps: [
|
|
{ label: '创建单据', current: false, time: '已完成' },
|
|
{ label: '直属领导审批', current: true, time: '停留 2天3小时' }
|
|
],
|
|
updatedAt: '2026-05-20T00:00:00.000Z'
|
|
})
|
|
|
|
assert.equal(label, '2天3小时')
|
|
})
|
|
|
|
test('document center stay time falls back to elapsed time from row timestamp', () => {
|
|
assert.equal(
|
|
formatDocumentDurationSince('2026-05-20T00:00:00.000Z', Date.parse('2026-05-21T01:30:00.000Z')),
|
|
'1天1小时'
|
|
)
|
|
assert.equal(
|
|
resolveDocumentStayTimeDisplay(
|
|
{ updatedAt: '2026-05-20T00:00:00.000Z' },
|
|
Date.parse('2026-05-20T01:05:00.000Z')
|
|
),
|
|
'1小时5分钟'
|
|
)
|
|
})
|