提交
This commit is contained in:
1 parent
8248e5ef15
commit
b9b4cc2673
57 files changed
+42800
-30473
No files matched your search
@@ -0,0 +1,56 @@
|
||||
import assert from 'node:assert/strict'
|
||||
import { mergeProgressWithComments } from '../src/utils/oa-progress-merge-comments'
|
||||
|
||||
const progress = [
|
||||
{
|
||||
key: 'submit',
|
||||
kind: 'submit',
|
||||
title: '发起人',
|
||||
status: 'submitted',
|
||||
timestamp: '2026-09-21 10:00:00'
|
||||
},
|
||||
{
|
||||
key: 'task-a',
|
||||
kind: 'task',
|
||||
title: '主管审批',
|
||||
status: 'approved',
|
||||
timestamp: '2026-09-21 10:05:00'
|
||||
},
|
||||
{
|
||||
key: 'task-b',
|
||||
kind: 'task',
|
||||
title: '经理审批',
|
||||
status: 'pending',
|
||||
timestamp: '2026-09-21 10:05:01'
|
||||
},
|
||||
{
|
||||
key: 'future',
|
||||
kind: 'task',
|
||||
title: '财务',
|
||||
status: 'not_reached',
|
||||
timestamp: ''
|
||||
}
|
||||
]
|
||||
|
||||
const comments = [
|
||||
{
|
||||
id: 'c1',
|
||||
content: '请补充材料',
|
||||
attachmentRefs: [],
|
||||
status: 'normal',
|
||||
createBy: 'u1',
|
||||
createByName: '张三',
|
||||
createTime: '2026-09-21 10:06:00',
|
||||
canRevoke: true
|
||||
}
|
||||
]
|
||||
|
||||
const out = mergeProgressWithComments(progress as any, comments as any)
|
||||
assert.equal(
|
||||
out.map((x) => x.key).join(','),
|
||||
'submit,task-a,comment-c1,task-b,future'
|
||||
)
|
||||
assert.equal(out[2].kind, 'comment')
|
||||
assert.equal(out[3].status, 'pending')
|
||||
assert.equal(out[4].status, 'not_reached')
|
||||
console.log('ok: mergeProgressWithComments')
|
||||
Reference in new issue
Block a user