fix: show pallets across warehouses by default
This commit is contained in:
@@ -31,19 +31,33 @@ describe('PalletsView', () => {
|
||||
vi.mocked(updatePallet).mockReset().mockResolvedValue(null)
|
||||
})
|
||||
|
||||
it('loads the all-warehouse pallet summary when the page opens', async () => {
|
||||
it('loads the all-warehouse pallet list and 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(listPallets).toHaveBeenCalledWith('', { page: 1, size: 10, keyword: undefined, palletType: undefined, status: undefined })
|
||||
expect(getPalletSummary).toHaveBeenCalledWith('', { page: 1, size: 10, keyword: undefined, palletType: undefined, status: undefined })
|
||||
expect(wrapper.get('[aria-label="托盘管理列表"]').text()).toContain('PLT-1')
|
||||
expect(wrapper.get('[aria-label="托盘管理列表"]').text()).not.toContain('请先选择仓库后查询')
|
||||
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('reloads all warehouses when the filters are reset', async () => {
|
||||
const wrapper = mount(PalletsView, { attachTo: document.body, global: { plugins: [ElementPlus] } })
|
||||
await flushPromises()
|
||||
vi.mocked(listPallets).mockClear()
|
||||
|
||||
wrapper.findComponent(QueryToolbar).vm.$emit('reset', { warehouseId: '', code: '', type: '', status: '' })
|
||||
await flushPromises()
|
||||
|
||||
expect(listPallets).toHaveBeenCalledWith('', { page: 1, size: 10, keyword: undefined, palletType: undefined, status: undefined })
|
||||
})
|
||||
|
||||
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