Skip to content

Commit 703ecd8

Browse files
committed
prepare tests for pk time shift
skipped for as not supported by tesseract
1 parent 7324166 commit 703ecd8

File tree

1 file changed

+120
-0
lines changed

1 file changed

+120
-0
lines changed

packages/cubejs-schema-compiler/test/integration/postgres/calendars.test.ts

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -678,5 +678,125 @@ cubes:
678678
},
679679
]));
680680
});
681+
682+
describe('PK dimension time-shifts', () => {
683+
it.skip('Count shifted by retail year (custom shift + custom granularity)1', async () => runQueryTest({
684+
measures: ['calendar_orders.count', 'calendar_orders.count_shifted_calendar_y'],
685+
timeDimensions: [{
686+
dimension: 'custom_calendar.date_val',
687+
granularity: 'year',
688+
dateRange: ['2025-02-02', '2026-02-01']
689+
}],
690+
order: [{ id: 'custom_calendar.date_val' }]
691+
}, [
692+
{
693+
calendar_orders__count: '37',
694+
calendar_orders__count_shifted_calendar_y: '39',
695+
custom_calendar__date_val_year: '2025-02-02T00:00:00.000Z',
696+
},
697+
]));
698+
699+
it.skip('Count shifted by retail month (custom shift + common granularity)', async () => runQueryTest({
700+
measures: ['calendar_orders.count', 'calendar_orders.count_shifted_calendar_m'],
701+
timeDimensions: [{
702+
dimension: 'custom_calendar.date_val',
703+
granularity: 'month',
704+
dateRange: ['2025-02-02', '2026-02-01']
705+
}],
706+
order: [{ id: 'custom_calendar.date_val' }]
707+
}, [
708+
{
709+
calendar_orders__count: '3',
710+
calendar_orders__count_shifted_calendar_m: '3',
711+
custom_calendar__date_val_month: '2025-02-01T00:00:00.000Z',
712+
},
713+
{
714+
calendar_orders__count: '3',
715+
calendar_orders__count_shifted_calendar_m: '4',
716+
custom_calendar__date_val_month: '2025-03-01T00:00:00.000Z',
717+
},
718+
{
719+
calendar_orders__count: '3',
720+
calendar_orders__count_shifted_calendar_m: '2',
721+
custom_calendar__date_val_month: '2025-04-01T00:00:00.000Z',
722+
},
723+
{
724+
calendar_orders__count: '3',
725+
calendar_orders__count_shifted_calendar_m: '2',
726+
custom_calendar__date_val_month: '2025-05-01T00:00:00.000Z',
727+
},
728+
{
729+
calendar_orders__count: '4',
730+
calendar_orders__count_shifted_calendar_m: '3',
731+
custom_calendar__date_val_month: '2025-06-01T00:00:00.000Z',
732+
},
733+
{
734+
calendar_orders__count: '4',
735+
calendar_orders__count_shifted_calendar_m: '4',
736+
custom_calendar__date_val_month: '2025-07-01T00:00:00.000Z',
737+
},
738+
{
739+
calendar_orders__count: '4',
740+
calendar_orders__count_shifted_calendar_m: '4',
741+
custom_calendar__date_val_month: '2025-08-01T00:00:00.000Z',
742+
},
743+
{
744+
calendar_orders__count: '4',
745+
calendar_orders__count_shifted_calendar_m: '3',
746+
custom_calendar__date_val_month: '2025-09-01T00:00:00.000Z',
747+
},
748+
{
749+
calendar_orders__count: '3',
750+
calendar_orders__count_shifted_calendar_m: '4',
751+
custom_calendar__date_val_month: '2025-10-01T00:00:00.000Z',
752+
},
753+
{
754+
calendar_orders__count: '3',
755+
calendar_orders__count_shifted_calendar_m: '3',
756+
custom_calendar__date_val_month: '2025-11-01T00:00:00.000Z',
757+
},
758+
{
759+
calendar_orders__count: '3',
760+
calendar_orders__count_shifted_calendar_m: '3',
761+
custom_calendar__date_val_month: '2025-12-01T00:00:00.000Z',
762+
},
763+
]));
764+
765+
it.skip('Count shifted by retail week (common shift + custom granularity)', async () => runQueryTest({
766+
measures: ['calendar_orders.count', 'calendar_orders.count_shifted_calendar_w'],
767+
timeDimensions: [{
768+
dimension: 'custom_calendar.date_val',
769+
granularity: 'week',
770+
dateRange: ['2025-02-02', '2026-02-01']
771+
}],
772+
order: [{ id: 'custom_calendar.date_val' }]
773+
}, [
774+
{
775+
calendar_orders__count: '1',
776+
calendar_orders__count_shifted_calendar_w: '1',
777+
custom_calendar__date_val_week: '2025-02-09T00:00:00.000Z',
778+
},
779+
{
780+
calendar_orders__count: '1',
781+
calendar_orders__count_shifted_calendar_w: '1',
782+
custom_calendar__date_val_week: '2025-02-16T00:00:00.000Z',
783+
},
784+
{
785+
calendar_orders__count: '1',
786+
calendar_orders__count_shifted_calendar_w: '1',
787+
custom_calendar__date_val_week: '2025-02-23T00:00:00.000Z',
788+
},
789+
{
790+
calendar_orders__count: '1',
791+
calendar_orders__count_shifted_calendar_w: '1',
792+
custom_calendar__date_val_week: '2025-03-16T00:00:00.000Z',
793+
},
794+
{
795+
calendar_orders__count: '1',
796+
calendar_orders__count_shifted_calendar_w: '1',
797+
custom_calendar__date_val_week: '2025-04-06T00:00:00.000Z',
798+
},
799+
]));
800+
});
681801
});
682802
});

0 commit comments

Comments
 (0)