2026-06-24 10:42:50 +08:00
|
|
|
import assert from 'node:assert/strict'
|
|
|
|
|
import { readFileSync } from 'node:fs'
|
|
|
|
|
import test from 'node:test'
|
2026-07-16 16:52:12 +08:00
|
|
|
import { fileURLToPath } from 'node:url'
|
2026-06-24 10:42:50 +08:00
|
|
|
|
|
|
|
|
function readProjectFile(path) {
|
2026-07-16 16:52:12 +08:00
|
|
|
return readFileSync(fileURLToPath(new URL(`../${path.replace(/^web\//, '')}`, import.meta.url)), 'utf8')
|
2026-06-24 10:42:50 +08:00
|
|
|
}
|
|
|
|
|
|
2026-07-16 16:52:12 +08:00
|
|
|
test('claim previews stay bounded while document review uses the approval task workspace', () => {
|
2026-06-24 10:42:50 +08:00
|
|
|
const useRequests = readProjectFile('web/src/composables/useRequests.js')
|
|
|
|
|
const useAppShell = readProjectFile('web/src/composables/useAppShell.js')
|
|
|
|
|
const documentsCenter = readProjectFile('web/src/views/DocumentsCenterView.vue')
|
2026-07-16 16:52:12 +08:00
|
|
|
const archiveRowsComposable = readProjectFile('web/src/composables/useDocumentCenterArchiveRows.js')
|
2026-06-24 10:42:50 +08:00
|
|
|
const approvalCenter = readProjectFile('web/src/views/scripts/ApprovalCenterView.js')
|
|
|
|
|
const archiveCenter = readProjectFile('web/src/views/scripts/ArchiveCenterView.js')
|
|
|
|
|
|
|
|
|
|
assert.match(useRequests, /REIMBURSEMENT_LIST_PREVIEW_PARAMS/)
|
|
|
|
|
assert.match(useRequests, /fetchExpenseClaims\(REIMBURSEMENT_LIST_PREVIEW_PARAMS\)/)
|
|
|
|
|
assert.doesNotMatch(useRequests, /fetchAllExpenseClaims\(\)/)
|
|
|
|
|
|
|
|
|
|
assert.match(useAppShell, /REIMBURSEMENT_LIST_PREVIEW_PARAMS/)
|
|
|
|
|
assert.match(useAppShell, /fetchApprovalExpenseClaims\(REIMBURSEMENT_LIST_PREVIEW_PARAMS\)/)
|
|
|
|
|
assert.doesNotMatch(useAppShell, /fetchAllApprovalExpenseClaims\(\)/)
|
|
|
|
|
|
2026-07-16 16:52:12 +08:00
|
|
|
assert.match(archiveRowsComposable, /fetchArchivedExpenseClaims\(REIMBURSEMENT_LIST_PREVIEW_PARAMS\)/)
|
|
|
|
|
assert.match(documentsCenter, /<ApprovalTaskWorkspace/)
|
|
|
|
|
assert.doesNotMatch(documentsCenter, /fetchApprovalExpenseClaims/)
|
2026-06-24 10:42:50 +08:00
|
|
|
assert.doesNotMatch(documentsCenter, /fetchAllApprovalExpenseClaims\(\)/)
|
|
|
|
|
assert.doesNotMatch(documentsCenter, /fetchAllArchivedExpenseClaims\(\)/)
|
|
|
|
|
|
2026-07-16 15:34:58 +08:00
|
|
|
assert.match(approvalCenter, /fetchApprovalWorkbenchItems\(\{ limit: 100 \}\)/)
|
|
|
|
|
assert.doesNotMatch(approvalCenter, /fetchApprovalExpenseClaims/)
|
2026-06-24 10:42:50 +08:00
|
|
|
|
|
|
|
|
assert.match(archiveCenter, /fetchArchivedExpenseClaims\(REIMBURSEMENT_LIST_PREVIEW_PARAMS\)/)
|
|
|
|
|
assert.doesNotMatch(archiveCenter, /fetchArchivedExpenseClaims\(\)/)
|
|
|
|
|
})
|