refactor(frontend): split large reimbursement and audit modules

This commit is contained in:
caoxiaozhu
2026-05-21 23:53:03 +08:00
parent 2908dda024
commit f6f787ff38
53 changed files with 15637 additions and 14179 deletions

View File

@@ -15,6 +15,18 @@ const reimbursementService = readFileSync(
fileURLToPath(new URL('../src/services/reimbursements.js', import.meta.url)),
'utf8'
)
const reviewActionsScript = readFileSync(
fileURLToPath(new URL('../src/views/scripts/useTravelReimbursementReviewActions.js', import.meta.url)),
'utf8'
)
const submitComposerScript = readFileSync(
fileURLToPath(new URL('../src/views/scripts/useTravelReimbursementSubmitComposer.js', import.meta.url)),
'utf8'
)
const attachmentsScript = readFileSync(
fileURLToPath(new URL('../src/views/scripts/useTravelReimbursementAttachments.js', import.meta.url)),
'utf8'
)
test('review drawer tools expose the default review tab before conditional document and risk tabs', () => {
assert.match(createViewTemplate, /title="报销识别核对"[\s\S]*@click="switchToReviewOverviewDrawer"/)
@@ -143,3 +155,36 @@ test('review drawer save action is disabled while receipt recognition is submitt
/function saveInlineReviewChanges\(\) \{[\s\S]*\|\| submitting\.value[\s\S]*\|\| sessionSwitchBusy\.value[\s\S]*\) return/
)
})
test('draft creation waits for composer attachments to be persisted before leaving submit state', () => {
assert.match(
submitComposerScript,
/try \{\s*await syncComposerFilesToDraft\(resolvedDraftClaimId, files\)\s*\} catch \(error\) \{/s
)
assert.doesNotMatch(
submitComposerScript,
/syncComposerFilesToDraft\(resolvedDraftClaimId, files\)\.catch/
)
assert.ok(
submitComposerScript.indexOf('await syncComposerFilesToDraft(resolvedDraftClaimId, files)') <
submitComposerScript.indexOf('submitting.value = false'),
'attachment persistence should finish before submit state is cleared'
)
assert.match(attachmentsScript, /function normalizeAttachmentMatchName\(value\)/)
assert.match(attachmentsScript, /const normalizedMatchBuckets = new Map\(\)/)
assert.match(
attachmentsScript,
/const targetItem = nextExactMatch \|\| nextNormalizedMatch \|\| fallbackMatch/
)
})
test('review summary renders markdown and save draft relies on backend response only', () => {
assert.match(
createViewTemplate,
/message\.text && message\.role === 'assistant' && message\.reviewPayload[\s\S]*v-html="renderMarkdown\(message\.text\)"/
)
assert.doesNotMatch(
reviewActionsScript,
/messages\.value\.push\(\s*createMessage\('assistant', actionConfig\.successMessage/
)
})