This commit is contained in:
2026-09-08 18:16:33 +08:00
parent 34f0ec4980
commit 296a8246ad
2 changed files with 15 additions and 12 deletions
@@ -64,8 +64,7 @@ describe('inventory customer-name snapshots', () => {
await flushPromises()
expect(wrapper.text()).toContain('华远贸易')
expect(wrapper.text()).toContain('洛杉矶仓')
expect(wrapper.text()).toContain('入库单号')
expect(wrapper.text()).toContain(balance.inboundOrderNo)
expect(wrapper.find('.overseas-detail-title p').text()).toBe(`入库单号 / 入仓码 / SKU ${balance.inboundOrderNo} / ${balance.inboundCode} / ${balance.skuCode}`)
expect(wrapper.text()).toContain('美本土散板')
expect(wrapper.text()).not.toContain('美本土散版')
expect(wrapper.text()).not.toContain('ONT8目的仓')
@@ -73,22 +72,21 @@ describe('inventory customer-name snapshots', () => {
expect(wrapper.text()).not.toContain(balance.id)
})
it('falls back to the inbound code and then an explicit empty business reference without exposing the inventory id', async () => {
vi.mocked(listInventoryBalances).mockResolvedValueOnce({ records: [{ ...balance, inboundOrderNo: '' }], page: 1, size: 10, total: 1, pages: 1 })
it('combines the available references and then shows an explicit empty business reference without exposing the inventory id', async () => {
vi.mocked(listInventoryBalances).mockResolvedValueOnce({ records: [{ ...balance, inboundOrderNo: '', skuCode: '' }], page: 1, size: 10, total: 1, pages: 1 })
routing.route.params = { inventoryId: balance.id }
routing.route.query = { inboundCode: balance.inboundCode, skuCode: balance.skuCode }
routing.route.query = { inboundCode: balance.inboundCode }
const inboundCodeWrapper = mount(InventoryDetailView, { attachTo: document.body, global: { plugins: [createPinia(), ElementPlus] } })
await flushPromises()
expect(inboundCodeWrapper.text()).toContain('入仓码')
expect(inboundCodeWrapper.text()).toContain(balance.inboundCode)
expect(inboundCodeWrapper.find('.overseas-detail-title p').text()).toBe(`入仓码 ${balance.inboundCode}`)
expect(inboundCodeWrapper.text()).not.toContain(balance.id)
inboundCodeWrapper.unmount()
vi.mocked(listInventoryBalances).mockResolvedValueOnce({ records: [{ ...balance, inboundOrderNo: '', inboundCode: '' }], page: 1, size: 10, total: 1, pages: 1 })
routing.route.query = { skuCode: balance.skuCode }
vi.mocked(listInventoryBalances).mockResolvedValueOnce({ records: [{ ...balance, inboundOrderNo: '', inboundCode: '', skuCode: '' }], page: 1, size: 10, total: 1, pages: 1 })
routing.route.query = {}
const emptyWrapper = mount(InventoryDetailView, { attachTo: document.body, global: { plugins: [createPinia(), ElementPlus] } })
await flushPromises()
expect(emptyWrapper.text()).toContain('业务标识')
expect(emptyWrapper.find('.overseas-detail-title p').text()).toBe('业务标识 —')
expect(emptyWrapper.text()).not.toContain(balance.id)
})
})