2026-08-11 11:41:47 +08:00
|
|
|
import { readFileSync } from 'node:fs'
|
|
|
|
|
import { resolve } from 'node:path'
|
|
|
|
|
import { describe, expect, it } from 'vitest'
|
|
|
|
|
|
|
|
|
|
const source = readFileSync(resolve(process.cwd(), 'src/modules/finance/pages/FinanceManualPage.vue'), 'utf8')
|
|
|
|
|
|
|
|
|
|
describe('FinanceManualPage delivery contract', () => {
|
|
|
|
|
it('keeps every business table operation column first and fixed left', () => {
|
|
|
|
|
const declarations = [...source.matchAll(/return \[([^\n]+)\]/g)].map((match) => match[1] || '').filter((value) => value.includes("key: 'actions'"))
|
|
|
|
|
expect(declarations).toHaveLength(3)
|
|
|
|
|
for (const declaration of declarations) {
|
|
|
|
|
expect(declaration.trim().startsWith("{ key: 'actions'")).toBe(true)
|
|
|
|
|
expect(declaration).toContain("fixed: 'left'")
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('exposes supported bill operations with permission checks and traceable errors', () => {
|
|
|
|
|
expect(source).toContain("platform:finance:bill:update")
|
|
|
|
|
expect(source).toContain("platform:finance:bill:adjust")
|
|
|
|
|
expect(source).toContain("platform:finance:bill:void")
|
|
|
|
|
expect(source).toContain("openBill(row, 'detail')")
|
|
|
|
|
expect(source).toContain("openBill(row, 'edit')")
|
|
|
|
|
expect(source).toContain("openBill(row, 'adjust')")
|
|
|
|
|
expect(source).toContain('<ApiErrorMeta :details="actionError"')
|
|
|
|
|
expect(source).toContain('<ApiErrorMeta :details="drawerError"')
|
|
|
|
|
})
|
|
|
|
|
|
2026-08-11 13:55:23 +08:00
|
|
|
it('uses real voucher uploads, requires container volume snapshots and declares narrow-screen layouts', () => {
|
|
|
|
|
expect(source).toContain('uploadFinanceVoucher(form.customerId, file.value)')
|
|
|
|
|
expect(source).toContain('voucherFileIds = uploadedVoucher.value ? [uploadedVoucher.value.fileId] : []')
|
|
|
|
|
expect(source).toContain("form.costType === 'CONTAINER_SHARED' && containerOrders.some")
|
|
|
|
|
expect(source).toContain('containerOrders.map((item) =>')
|
|
|
|
|
expect(source).toContain('体积(CBM)')
|
|
|
|
|
expect(source).toContain('type="file" accept="image/*" :disabled="saving"')
|
2026-08-11 11:41:47 +08:00
|
|
|
expect(source).toContain('@media (max-width: 720px)')
|
|
|
|
|
expect(source).toContain('@media (max-width: 480px)')
|
|
|
|
|
expect(source).toContain('grid-template-columns: 1fr')
|
|
|
|
|
})
|
2026-08-11 13:55:23 +08:00
|
|
|
|
|
|
|
|
it('shows an explicit revision query blocker instead of fabricated history', () => {
|
|
|
|
|
expect(source).toContain('修订记录查询接口尚未提供')
|
|
|
|
|
expect(source).not.toContain('mockRevision')
|
|
|
|
|
})
|
2026-08-11 11:41:47 +08:00
|
|
|
})
|