优化
This commit is contained in:
@@ -32,6 +32,24 @@ beforeEach(() => {
|
||||
})
|
||||
afterEach(() => { wrappers.splice(0).forEach(wrapper => wrapper.unmount()); vi.useRealTimers(); vi.restoreAllMocks() })
|
||||
describe('warehouse operating dashboard', () => {
|
||||
it.each([
|
||||
['1896.0666666666667', '1,896.07'],
|
||||
[1896.0666666666667, '1,896.07'],
|
||||
['1200', '1,200'],
|
||||
['12.5', '12.5'],
|
||||
['0', '0'],
|
||||
[null, '—'],
|
||||
])('formats the daily average %s without changing the returned metric', async (value, expected) => {
|
||||
const response = structuredClone(dashboardFixture)
|
||||
response.kpis.averageDailyOutboundQuantity.value = value
|
||||
mocks.dashboard.mockResolvedValue(response)
|
||||
const wrapper = page(); await choose(wrapper, { warehouseCode: 'WH-A' })
|
||||
const card = wrapper.findAll('.dashboard-kpis section').find(node => node.find('h3').text() === '所选时段日均出库')!
|
||||
expect(card.find('strong').text()).toBe(expected)
|
||||
expect(card.text()).toContain('件/日')
|
||||
expect(response.kpis.averageDailyOutboundQuantity.value).toBe(value)
|
||||
})
|
||||
|
||||
it.each(['PARTIAL', 'UNKNOWN'])('renders omitted nullable KPI fields for %s instead of rejecting the dashboard', async status => {
|
||||
const response = structuredClone(dashboardFixture)
|
||||
for (const metric of Object.values(response.kpis)) {
|
||||
@@ -246,6 +264,8 @@ describe('warehouse operating dashboard', () => {
|
||||
expect(wrapper.text()).toContain('区间已采集出库量')
|
||||
expect(wrapper.text()).toContain('已知小计 128')
|
||||
expect(wrapper.text()).toContain('另 1 SKU 待核验')
|
||||
expect(wrapper.find('.dashboard-kpis').text()).not.toContain('另 0 SKU 待核验')
|
||||
expect(wrapper.findAll('.dashboard-kpis small').every(node => node.text() !== '—')).toBe(true)
|
||||
expect(wrapper.text()).not.toContain('lingxing-primary')
|
||||
})
|
||||
it('changes the shared date range while pinning versions, then explicitly refreshes the whole snapshot', async () => {
|
||||
|
||||
Reference in New Issue
Block a user