import assert from 'node:assert/strict' import { readFileSync } from 'node:fs' import { join } from 'node:path' const root = process.cwd() function readProjectFile(path) { return readFileSync(join(root, path), 'utf8') } function testReceiptFolderViewSurface() { const view = readProjectFile('web/src/views/ReceiptFolderView.vue') assert.match(view, /activeStatus = ref\('all'\)/) assert.match(view, /value: 'all'/) assert.match(view, /openAssociateDialog/) assert.match(view, /receipt-detail-toolbar/) assert.match(view, /receipt-dashboard/) assert.match(view, /receipt-dashboard-preview/) assert.match(view, /receipt-dashboard-side/) assert.match(view, /receipt-dashboard-bottom/) assert.match(view, /receipt-ocr-panel/) assert.match(view, /receipt-status-panel/) assert.match(view, /keyReceiptFields/) assert.match(view, /editableOtherFields/) assert.match(view, /ocrPreviewFields/) assert.match(view, /class="receipt-key-grid"/) assert.match(view, /class="receipt-other-collapse"/) assert.match(view, /class="receipt-other-scroll"/) assert.match(view, /previewTransform/) assert.match(view, /openAssociateDialogForCurrentReceipt/) assert.match(view, /createReceiptDetailDashboardModel/) assert.match(view, /ElCollapse/) assert.doesNotMatch(view, /addField/) assert.match(view, /const isTrainTicket = computed/) assert.doesNotMatch(view, /打开源文件/) assert.doesNotMatch(view, /openSourceFile/) assert.match(view, /back-label=/) assert.doesNotMatch(view, /back-btn/) assert.match(view, /deleteCurrentReceipt/) assert.match(view, /ElCheckboxGroup/) assert.match(view, /fetchReceiptFolderItems\('all'\)/) assert.match(view, /buildReceiptFile\(item\)/) assert.match(view, /source: selectedDraft \? 'detail' : 'receipt-folder'/) assert.match(view, /emit\('open-assistant'/) } function testReceiptFolderServiceContract() { const service = readProjectFile('web/src/services/receiptFolder.js') const ocrService = readProjectFile('web/src/services/ocr.js') const reimbursementService = readProjectFile('web/src/services/reimbursements.js') assert.match(service, /\/receipt-folder\$\{buildStatusQuery\(status\)\}/) assert.match(service, /\/receipt-folder\/\$\{encodeURIComponent/) assert.match(service, /responseType: 'blob'/) assert.match(service, /new File\(\[blob\], fileName/) assert.match(service, /receiptId/) assert.match(ocrService, /formData\.append\('receipt_ids'/) assert.match(reimbursementService, /formData\.append\('receipt_id'/) } function testAppShellWiresReceiptFolder() { const shell = readProjectFile('web/src/views/AppShellRouteView.vue') const topBar = readProjectFile('web/src/components/layout/TopBar.vue') assert.match(shell, /activeView === 'receiptFolder'/) assert.match(shell, /ReceiptFolderView/) assert.match(shell, /@open-assistant="openSmartEntry"/) assert.match(shell, /@detail-open-change="receiptFolderDetailOpen = \$event"/) assert.match(shell, /@detail-topbar-change="detailTopBarPayload = \$event"/) assert.match(shell, /receipt-folder-workarea/) assert.match(topBar, /receiptFolder/) assert.match(topBar, /eyebrowLabel/) } function testSharedDocumentListStyleReuse() { const receiptView = readProjectFile('web/src/views/ReceiptFolderView.vue') const documentView = readProjectFile('web/src/views/DocumentsCenterView.vue') const receiptStyles = readProjectFile('web/src/assets/styles/views/receipt-folder-view.css') const sharedStyles = readProjectFile('web/src/assets/styles/components/document-list-shared.css') assert.match(receiptView, /document-list-shared\.css/) assert.match(documentView, /document-list-shared\.css/) assert.match(sharedStyles, /\.table-wrap\b/) assert.match(sharedStyles, /\.doc-kind-tag\b/) assert.match(sharedStyles, /\.list-foot\b/) assert.doesNotMatch(receiptStyles, /\.table-wrap\b/) assert.doesNotMatch(receiptStyles, /\.doc-kind-tag\b/) assert.doesNotMatch(receiptStyles, /\.list-foot\b/) } function testReceiptFolderDetailLayoutAdjustments() { const receiptView = readProjectFile('web/src/views/ReceiptFolderView.vue') const receiptStyles = readProjectFile('web/src/assets/styles/views/receipt-folder-view.css') const fieldModel = readProjectFile('web/src/views/scripts/receiptFolderDetailFields.js') assert.match(receiptView, /showStatusColumn/) assert.match(receiptView, //) assert.match(receiptView, //) assert.match(receiptView, /document_date/) assert.match(receiptView, /\s*/) assert.match(receiptView, /\s*