fix(self-operated): follow selected dates in hot rankings
This commit is contained in:
@@ -12,7 +12,7 @@ describe('dashboard exact drilldown contract', () => {
|
||||
expect(parsed.returnTo).toEqual({ rangePreset: 'LAST_15_DAYS', scroll: 650 })
|
||||
})
|
||||
it('preserves exact owner/SKU, maps hot enum and the independent finite candidate selector', () => {
|
||||
expect(parseDashboardDrilldown({ ...base, analysis: 'HOT', windowDays: '30', customerCode: 'OWNER-B', sku: 'SKU-X' }, 'sales')).toMatchObject({ customerCode: 'OWNER-B', analysis: 'hot' })
|
||||
expect(parseDashboardDrilldown({ ...base, analysis: 'HOT', rangePreset: 'CUSTOM', startDate: '2026-09-13', endDate: '2026-10-12', customerCode: 'OWNER-B', sku: 'SKU-X' }, 'sales')).toMatchObject({ customerCode: 'OWNER-B', analysis: 'hot' })
|
||||
expect(parseDashboardDrilldown({ ...base, coverageSelection: 'FINITE_POSITIVE', sortBy: 'COVERAGE_DAYS_DESC' }, 'inventory')?.inventory).toMatchObject({ coverageSelection: 'FINITE_POSITIVE', sortBy: 'COVERAGE_DAYS_DESC' })
|
||||
expect(parseDashboardDrilldown({ ...base, analysis: 'SKU', rangePreset: 'CUSTOM', startDate: '2026-10-12', endDate: '2026-10-12' }, 'sales')).toMatchObject({ analysis: 'summary', startDate: '2026-10-12', endDate: '2026-10-12' })
|
||||
})
|
||||
@@ -28,6 +28,9 @@ describe('dashboard exact drilldown contract', () => {
|
||||
expect(() => parseDashboardDrilldown(Object.fromEntries(Object.entries({ ...base, ...invalid }).filter(([, value]) => value !== undefined)) as Record<string, string>, 'inventory')).toThrow()
|
||||
})
|
||||
it('rejects invalid date/analysis/source and keeps warehouse selection mandatory', () => {
|
||||
expect(parseDashboardDrilldown({ ...base, analysis: 'HOT', rangePreset: 'CUSTOM', startDate: '2026-09-01', endDate: '2026-10-13' }, 'sales')).toMatchObject({ analysis: 'hot', rangePreset: 'CUSTOM', startDate: '2026-09-01', endDate: '2026-10-13' })
|
||||
expect(() => parseDashboardDrilldown({ ...base, analysis: 'HOT', windowDays: '30' }, 'sales')).toThrow()
|
||||
expect(() => parseDashboardDrilldown({ ...base, analysis: 'HOT', rangePreset: 'CUSTOM', startDate: '2026-10-13', endDate: '2026-10-12' }, 'sales')).toThrow()
|
||||
expect(() => parseDashboardDrilldown({ ...base, analysis: 'ALL' }, 'sales')).toThrow()
|
||||
expect(() => parseDashboardDrilldown({ ...base, analysis: 'SKU', rangePreset: 'CUSTOM', startDate: '2026-02-30', endDate: '2026-02-30' }, 'sales')).toThrow()
|
||||
expect(() => parseDashboardDrilldown({ ...base, from: 'https://example.com' }, 'sales')).toThrow()
|
||||
|
||||
Reference in New Issue
Block a user