Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions packages/objectql/src/engine-count-read-filter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,15 @@ describe('engine read scoping — count/aggregate honor injected filters (#2737)
await ql.aggregate('note', {
where: { title: 'x' },
groupBy: ['owner'],
aggregations: [{ func: 'count', field: 'id', alias: 'n' }],
} as any);
aggregations: [{ function: 'count', field: 'id', alias: 'n' }],
});

expect(seen.aggregateAst?.where).toEqual({ $and: [{ title: 'x' }, { owner: 'me' }] });
// groupBy/aggregations survive on the same ast.
expect(seen.aggregateAst?.groupBy).toEqual(['owner']);
expect(seen.aggregateAst?.aggregations).toEqual([
{ function: 'count', field: 'id', alias: 'n' },
]);
});

it('count() and find() see the SAME scoped where (total matches records)', async () => {
Expand Down
7 changes: 5 additions & 2 deletions packages/objectql/src/engine-filter-tokens.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,15 @@ describe('engine filter placeholders (framework#3582)', () => {
await ql.aggregate('deal', {
where: { close_date: { $gte: '{current_year_start}' } },
groupBy: ['owner'],
aggregations: [{ func: 'count', field: 'id', alias: 'n' }],
aggregations: [{ function: 'count', field: 'id', alias: 'n' }],
context: CTX,
} as any);
});

expect(seen.aggregateAst?.where).toEqual({ close_date: { $gte: THIS_YEAR_START } });
expect(seen.aggregateAst?.groupBy).toEqual(['owner']);
expect(seen.aggregateAst?.aggregations).toEqual([
{ function: 'count', field: 'id', alias: 'n' },
]);
});

it('throws on an unknown placeholder instead of matching nothing', async () => {
Expand Down
2 changes: 1 addition & 1 deletion scripts/query-options-erasure-baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,6 @@
"packages/services/service-settings/src/settings-service.ts": 2
},
"testSurface": {
"sites": 242
"sites": 240
}
}
Loading