empty should match everything

Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
Fredrik Adelöw
2026-02-20 12:09:38 +01:00
parent 06ac10a0c2
commit b8355e7208
2 changed files with 9 additions and 3 deletions
@@ -150,8 +150,14 @@ describe.each(databases.eachSupportedId())(
).resolves.toEqual(['service-a', 'service-b']);
});
it('returns nothing for empty $all', async () => {
await expect(query({ $all: [] })).resolves.toEqual([]);
it('matches everything for empty $all', async () => {
await expect(query({ $all: [] })).resolves.toEqual([
'api-d',
'bare-e',
'service-a',
'service-b',
'website-c',
]);
});
it('filters with $any', async () => {
@@ -105,7 +105,7 @@ export function applyPredicateEntityFilterToQuery(options: {
if ('$all' in filter) {
if (filter.$all.length === 0) {
return targetQuery.andWhereRaw('1 = 0');
return targetQuery;
}
return targetQuery.andWhere(outer => {
for (const subFilter of filter.$all) {