This commit is contained in:
2026-08-13 14:37:59 +08:00
parent d0394210f6
commit da20613aa0
17 changed files with 50 additions and 54 deletions
@@ -83,9 +83,9 @@ describe('Finance G3/G4 views', () => {
vi.mocked(createFinanceSettlementPayment).mockReset().mockResolvedValue({ ...settlementDetail, paidAmount: 100, outstandingAmount: 100, status: 'PARTIALLY_PAID', version: 5 })
})
it('hides G3/G4 commands when only legacy bill view permission is present', async () => {
const statements = await mountWithAccess(FinanceCustomerStatementsView, ['platform:finance:bill:view'])
const settlements = await mountWithAccess(FinanceFormalSettlementPage, ['platform:finance:bill:view'], { kind: 'payable' })
it('hides G3/G4 commands when list permissions are absent', async () => {
const statements = await mountWithAccess(FinanceCustomerStatementsView, [])
const settlements = await mountWithAccess(FinanceFormalSettlementPage, [], { kind: 'payable' })
expect(statements.text()).not.toContain('生成对账单')
expect(settlements.text()).toContain('无权访问结算单应付')
expect(createPayableSettlement).not.toHaveBeenCalled()
@@ -93,7 +93,7 @@ describe('Finance G3/G4 views', () => {
})
it('submits every selected adjustment line with the detail version', async () => {
const wrapper = await mountWithAccess(FinanceCustomerStatementsView, ['platform:finance:bill:view', 'platform:finance:reconciliation:adjust'])
const wrapper = await mountWithAccess(FinanceCustomerStatementsView, ['platform:finance:customer-statement:list', 'platform:finance:reconciliation:adjust'])
const vm = wrapper.vm as unknown as { openAdjustment(row: FinanceStatementReadModel): Promise<void>; submitAdjustment(): Promise<void>; adjustReason: string; adjustLines: Array<{ selected: boolean; adjustedAmount: number; reason: string }> }
await vm.openAdjustment(statement)
vm.adjustReason = '月末核对更正'
@@ -103,7 +103,7 @@ describe('Finance G3/G4 views', () => {
})
it('creates a payable settlement and registers a voucher-backed payment', async () => {
const wrapper = await mountWithAccess(FinanceFormalSettlementPage, ['platform:finance:settlement-ap:view', 'platform:finance:settlement-ap:create', 'platform:finance:payment:create'], { kind: 'payable' })
const wrapper = await mountWithAccess(FinanceFormalSettlementPage, ['platform:finance:settlement-ap:list', 'platform:finance:settlement-ap:create', 'platform:finance:payment:create'], { kind: 'payable' })
const vm = wrapper.vm as unknown as { load(model: Record<string, string>): Promise<void>; openCreate(): Promise<void>; submitCreate(): Promise<void>; openPayment(row: FinancePayableSettlement): void; submitPayment(): Promise<void>; createForm: { supplierId: string; dueDate: string; feeSourceIds: string[] }; paymentFile: File | null; paymentForm: { amount: number; transactionDate: string; method: 'BANK_TRANSFER'; referenceNo: string; remark: string } }
await vm.load({ customerId: '10001' }); await vm.openCreate()
expect(listPlatformPartners).toHaveBeenCalledWith({ page: 1, size: 200, status: 'ACTIVE' })
@@ -118,7 +118,7 @@ describe('Finance G3/G4 views', () => {
it('renders request and trace ids when G3 detail loading fails', async () => {
vi.mocked(getReconciliationStatement).mockRejectedValueOnce(new ApiResponseError('对账单不可用', 'FIN_404', 404, undefined, 'req-g3-error', 'trace-g3-error'))
const wrapper = await mountWithAccess(FinanceCustomerStatementsView, ['platform:finance:bill:view'])
const wrapper = await mountWithAccess(FinanceCustomerStatementsView, ['platform:finance:customer-statement:list'])
const vm = wrapper.vm as unknown as { openDetail(row: FinanceStatementReadModel): Promise<void> }
await vm.openDetail(statement); await flushPromises()
expect(document.body.textContent).toContain('req-g3-error')
@@ -126,9 +126,9 @@ describe('Finance G3/G4 views', () => {
})
it('loads all customers by default and applies explicit customer filters', async () => {
const statements = await mountWithAccess(FinanceCustomerStatementsView, ['platform:finance:bill:view'])
const receivables = await mountWithAccess(FinanceFormalSettlementPage, ['platform:finance:settlement-ar:view'], { kind: 'receivable' })
const payables = await mountWithAccess(FinanceFormalSettlementPage, ['platform:finance:settlement-ap:view'], { kind: 'payable' })
const statements = await mountWithAccess(FinanceCustomerStatementsView, ['platform:finance:customer-statement:list'])
const receivables = await mountWithAccess(FinanceFormalSettlementPage, ['platform:finance:settlement-ar:list'], { kind: 'receivable' })
const payables = await mountWithAccess(FinanceFormalSettlementPage, ['platform:finance:settlement-ap:list'], { kind: 'payable' })
expect(listFinanceStatements).toHaveBeenCalledWith(undefined)
expect(listFinanceReceivableSettlements).toHaveBeenCalledWith(undefined)