test(catalog): add GET /entity-facets backward compatibility test with filter

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
Fredrik Adelöw
2026-02-26 17:13:01 +01:00
parent 12b790d3c3
commit 4c4632ce1b
@@ -1203,6 +1203,26 @@ describe('createRouter readonly disabled', () => {
facets: { kind: [{ value: 'Component', count: 5 }] },
});
});
it('returns facets with filter parameter', async () => {
entitiesCatalog.facets.mockResolvedValue({
facets: { 'spec.type': [{ value: 'service', count: 3 }] },
});
const response = await request(app).get(
'/entity-facets?facet=spec.type&filter=kind=Component',
);
expect(response.status).toBe(200);
expect(response.body).toEqual({
facets: { 'spec.type': [{ value: 'service', count: 3 }] },
});
expect(entitiesCatalog.facets).toHaveBeenCalledWith(
expect.objectContaining({
facets: ['spec.type'],
filter: { key: 'kind', values: ['Component'] },
}),
);
});
});
describe('POST /entity-facets', () => {