Files
X-Financial/web/tests/expense-application-preview-reason.test.mjs

27 lines
879 B
JavaScript
Raw Permalink Normal View History

import assert from 'node:assert/strict'
import test from 'node:test'
import {
buildLocalApplicationPreview
} from '../src/utils/expenseApplicationPreview.js'
test('application preview keeps compact travel meeting reason without date or location prefix', () => {
const preview = buildLocalApplicationPreview(
'2月20-23日去上海出差参加相关残联会议',
{
name: '曹笑竹',
departmentName: '技术部',
position: '财务智能化产品经理',
managerName: '向万红',
grade: 'P5'
},
{ today: '2026-06-09' }
)
assert.equal(preview.fields.time, '2026-02-20 至 2026-02-23')
assert.equal(preview.fields.days, '4天')
assert.equal(preview.fields.location, '上海')
assert.equal(preview.fields.reason, '参加相关残联会议')
assert.doesNotMatch(preview.fields.reason, /2月20|23日|上海|出差/)
})