feat(selfop): select inventory sales window and cutoff date

This commit is contained in:
2026-10-13 12:36:45 +08:00
parent 58df0ed9e3
commit 9dcd991ddb
7 changed files with 104 additions and 34 deletions
@@ -5,6 +5,11 @@ const http = vi.hoisted(() => ({ get: vi.fn(), post: vi.fn() }))
vi.mock('@/shared/api/http', () => ({ http, unwrapApiResponse: (value: { data: unknown }) => value.data }))
beforeEach(() => { vi.clearAllMocks(); http.get.mockResolvedValue({ data: {} }); http.post.mockResolvedValue({ data: { taskNo: 'COL-001', status: 'QUEUED' } }) })
describe('self-operated platform transport contract', () => {
it('forwards the inventory window, inclusive end and pinned page without renaming them', async () => {
const params = { sourceAccount: 'lingxing-primary', warehouseCode: 'WH-A', salesWindowDays: 10 as const, salesWindowEndDate: '2026-10-12', current: 2, size: 20, salesRunId: '11', inventoryRunId: '12', queryAsOf: '2026-10-13T00:00:00Z' }
await analyticsApi.inventory(params)
expect(http.get).toHaveBeenCalledWith('/platform/v1/last-leg/self-operated-analytics/inventory-coverage', { params, signal: undefined })
})
it('keeps dashboard business aggregation separate from sync-overview runtime polling', async () => {
const params = { sourceAccount: 'lingxing-primary', warehouseCode: 'WH-A', rangePreset: 'LAST_15_DAYS' as const, salesRunId: '11', inventoryRunId: '12', queryAsOf: '2026-10-13T00:00:00Z' }
await analyticsApi.dashboard(params)