fix: load overall overseas pallet summary
This commit is contained in:
@@ -31,6 +31,19 @@ describe('PalletsView', () => {
|
||||
vi.mocked(updatePallet).mockReset().mockResolvedValue(null)
|
||||
})
|
||||
|
||||
it('loads the all-warehouse pallet summary when the page opens', async () => {
|
||||
vi.mocked(getPalletSummary).mockResolvedValueOnce({ totalCount: 250, idleCount: 100, occupiedCount: 98, scrappedCount: 52 })
|
||||
|
||||
const wrapper = mount(PalletsView, { attachTo: document.body, global: { plugins: [ElementPlus] } })
|
||||
await flushPromises()
|
||||
|
||||
expect(getPalletSummary).toHaveBeenCalledWith('', {})
|
||||
expect(wrapper.get('[aria-label="海外托盘数量概览"]').text()).toContain('托盘总数250')
|
||||
expect(wrapper.get('[aria-label="海外托盘数量概览"]').text()).toContain('闲置托盘100')
|
||||
expect(wrapper.get('[aria-label="海外托盘数量概览"]').text()).toContain('占用托盘98')
|
||||
expect(wrapper.get('[aria-label="海外托盘数量概览"]').text()).toContain('已报废52')
|
||||
})
|
||||
|
||||
it('loads the current detail version and keeps the edit open on a conflict', async () => {
|
||||
vi.mocked(updatePallet).mockRejectedValueOnce(Object.assign(new Error('version conflict'), { code: 'A0409' }))
|
||||
const wrapper = mount(PalletsView, { attachTo: document.body, global: { plugins: [ElementPlus] } })
|
||||
|
||||
Reference in New Issue
Block a user