36 lines
1.7 KiB
TypeScript
36 lines
1.7 KiB
TypeScript
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"')
|
||
|
|
})
|
||
|
|
|
||
|
|
it('blocks uncontracted voucher uploads and declares narrow-screen layouts', () => {
|
||
|
|
expect(source).toContain('凭证上传接口尚未接通')
|
||
|
|
expect(source).toContain('type="file" accept="image/*" disabled')
|
||
|
|
expect(source).toContain('@media (max-width: 720px)')
|
||
|
|
expect(source).toContain('@media (max-width: 480px)')
|
||
|
|
expect(source).toContain('grid-template-columns: 1fr')
|
||
|
|
})
|
||
|
|
})
|