Revert "Make listLocations conform with current API"

This reverts commit 449972081db302c6c2a2938a45f90beb82e117c8.

Signed-off-by: Johan Haals <johan.haals@gmail.com>
This commit is contained in:
Johan Haals
2021-05-10 10:02:34 +02:00
parent e53223f15c
commit b23de0aeb6
3 changed files with 5 additions and 27 deletions
@@ -137,23 +137,8 @@ describe('DefaultLocationServiceTest', () => {
});
});
describe('listLocations', () => {
it('should call locationStore.listLocations', async () => {
store.listLocations.mockResolvedValue([
{
id: '123',
target: 'https://backstage.io/catalog-info.yaml',
type: 'url',
},
]);
await expect(locationService.listLocations()).resolves.toEqual([
{
data: {
id: '123',
target: 'https://backstage.io/catalog-info.yaml',
type: 'url',
},
},
]);
it('should call locationStore.deleteLocation', async () => {
await locationService.listLocations();
expect(store.listLocations).toBeCalled();
});
});
@@ -24,7 +24,6 @@ import {
LocationService,
LocationStore,
CatalogProcessingOrchestrator,
LocationResponse,
} from './types';
import { locationSpecToMetadataName } from './util';
@@ -88,11 +87,9 @@ export class DefaultLocationService implements LocationService {
return { location, entities: [] };
}
async listLocations(): Promise<LocationResponse[]> {
const locations = await this.store.listLocations();
return locations.map(location => ({ data: location }));
listLocations(): Promise<Location[]> {
return this.store.listLocations();
}
getLocation(id: string): Promise<Location> {
return this.store.getLocation(id);
}
+1 -5
View File
@@ -27,15 +27,11 @@ export interface LocationService {
spec: LocationSpec,
dryRun: boolean,
): Promise<{ location: Location; entities: Entity[] }>;
listLocations(): Promise<LocationResponse[]>;
listLocations(): Promise<Location[]>;
getLocation(id: string): Promise<Location>;
deleteLocation(id: string): Promise<void>;
}
export type LocationResponse = {
data: Location;
};
export interface LocationStore {
createLocation(spec: LocationSpec): Promise<Location>;
listLocations(): Promise<Location[]>;