优化
This commit is contained in:
@@ -136,4 +136,27 @@ describe('CustomerDetailView', () => {
|
||||
expect(downloadTenantQualification).toHaveBeenCalledWith(tenant.id, '/files/license.png')
|
||||
expect(document.querySelector('img[alt="license.png预览"]')).not.toBeNull()
|
||||
})
|
||||
|
||||
it('does not duplicate the first page request when retrying from a later page', async () => {
|
||||
const wrapper = mount(CustomerDetailView, { attachTo: document.body, global: { plugins: [pinia, ElementPlus] } })
|
||||
await flushPromises()
|
||||
vi.mocked(listPlatformFirstLegOrders).mockRejectedValueOnce(new Error('暂时不可用'))
|
||||
|
||||
const vm = wrapper.vm as unknown as { orderPage: number }
|
||||
vm.orderPage = 2
|
||||
await flushPromises()
|
||||
expect(listPlatformFirstLegOrders).toHaveBeenCalledTimes(2)
|
||||
|
||||
const ordersTab = [...document.querySelectorAll<HTMLButtonElement>('.detail-tabs button')]
|
||||
.find((button) => button.textContent?.trim() === '运单记录')
|
||||
ordersTab?.click()
|
||||
await flushPromises()
|
||||
const retryButton = [...document.querySelectorAll<HTMLButtonElement>('button')]
|
||||
.find((button) => button.textContent?.includes('重新加载'))
|
||||
retryButton?.click()
|
||||
await flushPromises()
|
||||
|
||||
expect(listPlatformFirstLegOrders).toHaveBeenCalledTimes(3)
|
||||
expect(listPlatformFirstLegOrders).toHaveBeenLastCalledWith({ tenantId: tenant.id, page: 1, size: 10 })
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user