Skip to content

Commit d0cb744

Browse files
committed
add tests for refreshScheduler.getCachedBuildJobs()
1 parent 15b5d97 commit d0cb744

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

packages/cubejs-server-core/test/unit/RefreshScheduler.test.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -840,10 +840,11 @@ describe('Refresh Scheduler', () => {
840840
const ctx = { authInfo: { tenantId: 'tenant1' }, securityContext: { tenantId: 'tenant1' }, requestId: 'XXX' };
841841

842842
let finish = false;
843+
let jobs: string[];
843844

844845
while (!finish) {
845846
try {
846-
await refreshScheduler.postBuildJobs(
847+
jobs = await refreshScheduler.postBuildJobs(
847848
ctx,
848849
{
849850
metadata: undefined,
@@ -882,6 +883,11 @@ describe('Refresh Scheduler', () => {
882883
expect(mockDriver.createdTables.filter(o => o.tableName.includes('foo_orphaned') && o.timezone === 'America/Los_Angeles').length).toEqual(5);
883884
expect(mockDriver.createdTables.filter(o => o.tableName.includes('foo_second') && o.timezone === 'UTC').length).toEqual(5);
884885
expect(mockDriver.createdTables.filter(o => o.tableName.includes('foo_second') && o.timezone === 'America/Los_Angeles').length).toEqual(5);
886+
887+
// Let's also test the getCachedBuildJobs()
888+
const buildJobs = await refreshScheduler.getCachedBuildJobs(ctx, jobs);
889+
const allTokensExist = jobs.every(token => buildJobs.some(job => job.token === token));
890+
expect(allTokensExist).toBeTruthy();
885891
});
886892

887893
test('Only `first` pre-aggregation', async () => {

0 commit comments

Comments
 (0)