提交
This commit is contained in:
1 parent
91b8dd1aaa
commit
89fda927a2
119 files changed
+36038
-28744
No files matched your search
@@ -84,14 +84,15 @@ function run() {
|
||||
nickName: '李四',
|
||||
status: 'transferred',
|
||||
commentText: '',
|
||||
timestamp: '2026-07-23 10:05:00'
|
||||
timestamp: '2026-07-23 10:05:00',
|
||||
transferToUserName: '赵六'
|
||||
},
|
||||
{ nickName: '赵六', status: 'pending', commentText: '', timestamp: '' }
|
||||
]
|
||||
const xferLines = formatProgressPersonLines(xfer)
|
||||
assert.deepEqual(
|
||||
xferLines.map((x) => x.text),
|
||||
['李四 已转交 2026-07-23 10:05:00', '赵六 待处理']
|
||||
['李四 转交给赵六 2026-07-23 10:05:00', '赵六 待处理']
|
||||
)
|
||||
assert.equal(xferLines[0].tone, 'mute')
|
||||
|
||||
@@ -100,12 +101,39 @@ function run() {
|
||||
nickName: '李四',
|
||||
status: 'transferred',
|
||||
commentText: '出差代批',
|
||||
timestamp: '2026-07-23 10:05:00'
|
||||
timestamp: '2026-07-23 10:05:00',
|
||||
transferToUserName: '赵六'
|
||||
}
|
||||
]
|
||||
assert.equal(
|
||||
formatProgressPersonLines(xferComment)[0].text,
|
||||
'李四 出差代批 2026-07-23 10:05:00'
|
||||
'李四 转交给赵六 出差代批 2026-07-23 10:05:00'
|
||||
)
|
||||
|
||||
// 转交目标缺失时回退「已转交」
|
||||
assert.equal(
|
||||
formatProgressPersonLines([
|
||||
{
|
||||
nickName: '李四',
|
||||
status: 'transferred',
|
||||
commentText: '',
|
||||
timestamp: '2026-07-23 10:05:00'
|
||||
}
|
||||
])[0].text,
|
||||
'李四 已转交 2026-07-23 10:05:00'
|
||||
)
|
||||
|
||||
// 转交目标缺失但有说明:仍用说明
|
||||
assert.equal(
|
||||
formatProgressPersonLines([
|
||||
{
|
||||
nickName: '胡圆凯',
|
||||
status: 'transferred',
|
||||
commentText: '123123',
|
||||
timestamp: '2026-07-23 17:35:12'
|
||||
}
|
||||
])[0].text,
|
||||
'胡圆凯 123123 2026-07-23 17:35:12'
|
||||
)
|
||||
|
||||
// 空 people
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* 轻量断言:OA 上传控件图片/非图片判定(tsx 直接跑 TypeScript 源码)
|
||||
* 用法:pnpm exec tsx scripts/check-oa-upload-file-type.mjs
|
||||
*/
|
||||
import assert from 'node:assert/strict'
|
||||
import {
|
||||
isOaUploadImageFile,
|
||||
isOaUploadVideoFile,
|
||||
getOaUploadDisplayName
|
||||
} from '../src/utils/oa-upload-file-type.ts'
|
||||
|
||||
assert.equal(isOaUploadImageFile({ name: 'a.png', url: 'https://x/a.png' }), true)
|
||||
assert.equal(isOaUploadImageFile({ name: 'a.PDF', url: 'https://x/a.PDF' }), false)
|
||||
assert.equal(isOaUploadImageFile({ name: 'x.docx', url: 'https://cdn/x.docx' }), false)
|
||||
assert.equal(isOaUploadImageFile({ name: 'blob', url: 'blob:http://localhost/1', raw: { type: 'image/jpeg' } }), true)
|
||||
assert.equal(isOaUploadImageFile({ name: 'report.xlsx', url: 'https://cdn/report.xlsx' }), false)
|
||||
|
||||
assert.equal(isOaUploadVideoFile({ name: 'a.mp4', url: 'https://x/a.mp4' }), true)
|
||||
assert.equal(isOaUploadVideoFile({ name: 'a.pdf', url: 'https://x/a.pdf' }), false)
|
||||
|
||||
assert.equal(getOaUploadDisplayName({ name: '合同.pdf', url: 'https://x/path/合同.pdf' }), '合同.pdf')
|
||||
assert.equal(getOaUploadDisplayName({ url: 'https://x/path/only-url.docx' }), 'only-url.docx')
|
||||
|
||||
console.log('ok: oa upload file type helpers')
|
||||
Reference in new issue
Block a user