| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- 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')
|