This commit is contained in:
2026-10-22 11:56:54 +08:00
parent 090431b409
commit 3e77c3976e
40 changed files with 976 additions and 241 deletions
@@ -33,7 +33,7 @@ describe('PalletsView', () => {
})
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 })
vi.mocked(getPalletSummary).mockResolvedValueOnce({ totalCount: 1250, idleCount: 1100, occupiedCount: 98, scrappedCount: 52 })
const wrapper = mount(PalletsView, { attachTo: document.body, global: { plugins: [ElementPlus] } })
await flushPromises()
@@ -42,10 +42,10 @@ describe('PalletsView', () => {
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')
const cards = wrapper.get('[aria-label="海外托盘数量概览"]').findAll('article')
expect(cards.map(card => card.get('h2').text())).toEqual(['托盘总数', '闲置托盘', '占用托盘', '已报废'])
expect(cards.map(card => card.get('strong').text())).toEqual(['1,250', '1,100', '98', '52'])
expect(cards.map(card => card.get('.workbench-metric-value > span').text())).toEqual(['个', '个', '个', '个'])
})
it('prints one pallet from the all-warehouse list and allows retry after failure', async () => {