fix(self-operated): clarify today's unavailable sales and tooltip precision

This commit is contained in:
2026-10-14 11:18:47 +08:00
parent e0f54edcc9
commit d8a4160bc7
5 changed files with 23 additions and 2 deletions
@@ -50,6 +50,14 @@ beforeEach(() => {
})
afterEach(() => { wrappers.splice(0).forEach(wrapper => wrapper.unmount()); vi.useRealTimers() })
describe('self-operated actual workbench request state', () => {
it('explains unknown today values and queries the preceding 30 complete days explicitly', async () => {
mocks.api.summary.mockResolvedValue({ context, records: [{ ...summary, observedQuantity: null, dataStatus: 'UNKNOWN' }], total: 1 })
const wrapper = mount(AnalyticsView, { ...options, props: { mode: 'sales' } }); wrappers.push(wrapper); await flushPromises()
expect(wrapper.text()).toContain('暂无可用数据')
expect(wrapper.text()).not.toContain('(已采集,未完整)')
await findButton(wrapper, '查看近30个完整日').trigger('click'); await flushPromises()
expect(mocks.api.summary.mock.calls.at(-1)?.[0]).toMatchObject({ rangePreset: 'CUSTOM', startDate: '2026-09-12', endDate: '2026-10-11' })
})
it.each(['sales', 'inventory'] as const)('automatically loads the first available warehouse on %s entry', async mode => {
mocks.routeQuery = {}
mocks.api.overview.mockResolvedValue({ ...overview, warehouses: [{ warehouseCode: 'WH-B' }, { warehouseCode: 'WH-A' }] })