优化
This commit is contained in:
@@ -232,6 +232,37 @@ describe('FinanceCustomerStatementsView', () => {
|
||||
expect(vm.filteredRows).toHaveLength(0)
|
||||
})
|
||||
|
||||
it('does not issue one detail request per statement for an ordinary query', async () => {
|
||||
vi.mocked(listFinanceStatements).mockResolvedValue(Array.from({ length: 60 }, (_, index) => ({
|
||||
...statement,
|
||||
id: String(501 + index),
|
||||
billNo: `REC-${501 + index}`,
|
||||
})))
|
||||
const { wrapper } = await mountPage()
|
||||
vi.mocked(listFinanceStatements).mockClear()
|
||||
vi.mocked(getReconciliationStatement).mockClear()
|
||||
|
||||
await (wrapper.vm as unknown as { load(model: Record<string, unknown>): Promise<void> }).load({ status: 'ISSUED' })
|
||||
await flushPromises()
|
||||
|
||||
expect(listFinanceStatements).toHaveBeenCalledTimes(1)
|
||||
expect(getReconciliationStatement).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('uses only the statement list request for an ordinary search', async () => {
|
||||
const { wrapper } = await mountPage()
|
||||
vi.mocked(listFinanceStatements).mockClear()
|
||||
vi.mocked(getReconciliationStatement).mockClear()
|
||||
|
||||
await (wrapper.vm as unknown as { load(model: Record<string, unknown>): Promise<void> }).load({
|
||||
status: 'ISSUED', billNo: '501', customerId: '', containerNo: '',
|
||||
periodStartRange: [], periodEndRange: [], settled: '', lastPaymentRange: [], createdRange: [],
|
||||
})
|
||||
|
||||
expect(listFinanceStatements).toHaveBeenCalledTimes(1)
|
||||
expect(getReconciliationStatement).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('keeps statement status filter options aligned with the list status column', async () => {
|
||||
const { wrapper } = await mountPage()
|
||||
const vm = wrapper.vm as unknown as {
|
||||
@@ -355,10 +386,10 @@ describe('FinanceCustomerStatementsView', () => {
|
||||
expect(document.body.textContent).not.toContain('hash-81')
|
||||
})
|
||||
|
||||
it('surfaces detail hydration failures instead of silently returning an empty filtered list', async () => {
|
||||
it('surfaces container-filter detail hydration failures instead of silently returning an empty filtered list', async () => {
|
||||
const { wrapper } = await mountPage()
|
||||
vi.mocked(getReconciliationStatement).mockRejectedValueOnce(new Error('detail unavailable'))
|
||||
await (wrapper.vm as unknown as { load(model: Record<string, unknown>): Promise<void> }).load({ status: 'ISSUED' })
|
||||
await (wrapper.vm as unknown as { load(model: Record<string, unknown>): Promise<void> }).load({ status: 'ISSUED', containerNo: 'CONT-31' })
|
||||
await flushPromises()
|
||||
expect(document.body.textContent).toContain('筛选字段加载失败')
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user