update to use getEntityByRef

Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
Fredrik Adelöw
2022-03-03 11:26:42 +01:00
parent a52f69987a
commit 899f196af5
41 changed files with 157 additions and 111 deletions
@@ -44,6 +44,7 @@ function mockCatalogClient(entity?: Entity): jest.Mocked<CatalogApi> {
const mock = {
addLocation: jest.fn(),
getEntities: jest.fn(),
getEntityByRef: jest.fn(),
getEntityByName: jest.fn(),
getLocationByRef: jest.fn(),
getLocationById: jest.fn(),
@@ -54,7 +55,7 @@ function mockCatalogClient(entity?: Entity): jest.Mocked<CatalogApi> {
getEntityFacets: jest.fn(),
};
if (entity) {
mock.getEntityByName.mockReturnValue(entity);
mock.getEntityByRef.mockReturnValue(entity);
}
return mock;
}
@@ -93,7 +94,7 @@ describe('TodoReaderService', () => {
offset: 0,
limit: 10,
});
expect(catalogClient.getEntityByName).toHaveBeenCalledWith(entityName, {
expect(catalogClient.getEntityByRef).toHaveBeenCalledWith(entityName, {
token: undefined,
});
});
@@ -304,7 +305,7 @@ describe('TodoReaderService', () => {
message: 'Entity not found, component:default/my-component',
}),
);
expect(catalogClient.getEntityByName).toHaveBeenCalledWith(entityName, {
expect(catalogClient.getEntityByRef).toHaveBeenCalledWith(entityName, {
token: undefined,
});
});
@@ -66,7 +66,7 @@ export class TodoReaderService implements TodoService {
throw new InputError('Entity filter is required to list TODOs');
}
const token = options?.token;
const entity = await this.catalogClient.getEntityByName(req.entity, {
const entity = await this.catalogClient.getEntityByRef(req.entity, {
token,
});
if (!entity) {