Address Copilot review: fix pagination test and add credentials assertion

Signed-off-by: Fredrik Adelöw <freben@spotify.com>
Made-with: Cursor
This commit is contained in:
Fredrik Adelöw
2026-04-03 23:23:42 +02:00
parent 999f308ad5
commit e7fdf2997f
2 changed files with 19 additions and 8 deletions
@@ -62,12 +62,16 @@ describe('CachedEntityLoader', () => {
it('writes entities to cache for user credentials', async () => {
cache.get.mockResolvedValue(undefined);
const catalog = catalogServiceMock({ entities: [entity] });
jest.spyOn(catalog, 'getEntityByRef');
auth.isPrincipal.mockReturnValue(true);
const loader = new CachedEntityLoader({ auth, catalog, cache });
const result = await loader.load(userCredentials, entityName);
expect(result).toEqual(entity);
expect(catalog.getEntityByRef).toHaveBeenCalledWith(entityName, {
credentials: userCredentials,
});
expect(cache.set).toHaveBeenCalledWith(
'catalog:component:default/test:user:default/test-user',
entity,