Skip to content

Commit 777ba91

Browse files
committed
test(service-analytics): an in-window September deal keeps the month case's rows the same with or without the empty-bucket fill
Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5msvniAz5h2mP2QABA
1 parent 2459847 commit 777ba91

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

‎packages/services/service-analytics/src/__tests__/dataset-drill-window.test.ts‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,7 @@ const DEALS: Array<{ id: string; stage: string; closed_at: string; close_on: str
304304
{ id: 'd7', stage: 'lost', closed_at: '2026-01-05T02:00:00.000Z', close_on: '2026-01-05' },
305305
{ id: 'd8', stage: 'won', closed_at: '2026-08-03T02:00:00.000Z', close_on: '2026-08-03' }, // August, before last_30_days
306306
{ id: 'd9', stage: 'won', closed_at: '2026-11-20T02:00:00.000Z', close_on: '2026-11-20' },
307+
{ id: 'd10', stage: 'lost', closed_at: '2026-09-05T02:00:00.000Z', close_on: '2026-09-05' },
307308
];
308309

309310
const deals = DatasetSchema.parse({
@@ -370,24 +371,26 @@ describe('#27074 — on a real engine, each row drill lists exactly the records
370371
[
371372
'stage × this_quarter on the datetime field, Shanghai',
372373
{ dimensions: ['stage'], timeDimensions: [{ dimension: 'closed', dateRange: 'this_quarter' }], timezone: SHANGHAI },
373-
{ won: ['d2', 'd3', 'd6', 'd8'], lost: ['d4'] },
374+
{ won: ['d2', 'd3', 'd6', 'd8'], lost: ['d10', 'd4'] },
374375
],
375376
[
376377
'stage × an explicit bare-day window on the datetime field, Shanghai',
377378
{ dimensions: ['stage'], timeDimensions: [{ dimension: 'closed', dateRange: ['2026-07-01', '2026-09-30'] }], timezone: SHANGHAI },
378379
// The explicit arm keeps the engine's UTC calendar day (ADR-0053 D-D):
379380
// d2 is Shanghai's July but UTC's June, d5 the other way round.
380-
{ won: ['d3', 'd6', 'd8'], lost: ['d4', 'd5'] },
381+
{ won: ['d3', 'd6', 'd8'], lost: ['d10', 'd4', 'd5'] },
381382
],
382383
[
383384
'month buckets × last_30_days on the datetime field, Shanghai',
384385
{ dimensions: ['closed'], timeDimensions: [{ dimension: 'closed', dateRange: 'last_30_days' }], timezone: SHANGHAI },
385-
{ '2026-08': ['d6'] },
386+
// Both in-window months hold a deal, so the answer has the same rows
387+
// whether or not empty buckets are filled.
388+
{ '2026-08': ['d6'], '2026-09': ['d10'] },
386389
],
387390
[
388391
'stage × this_quarter on the date field, UTC',
389392
{ dimensions: ['stage'], timeDimensions: [{ dimension: 'closed_on', dateRange: 'this_quarter' }] },
390-
{ won: ['d2', 'd3', 'd6', 'd8'], lost: ['d4'] },
393+
{ won: ['d2', 'd3', 'd6', 'd8'], lost: ['d10', 'd4'] },
391394
],
392395
[
393396
// The query compares a `date` column with the preset's Shanghai-midnight

0 commit comments

Comments
 (0)