From b23de0aeb671f02e81fa503fae974c81e377725f Mon Sep 17 00:00:00 2001 From: Johan Haals Date: Mon, 10 May 2021 10:02:34 +0200 Subject: [PATCH] Revert "Make listLocations conform with current API" This reverts commit 449972081db302c6c2a2938a45f90beb82e117c8. Signed-off-by: Johan Haals --- .../src/next/DefaultLocationService.test.ts | 19 ++----------------- .../src/next/DefaultLocationService.ts | 7 ++----- plugins/catalog-backend/src/next/types.ts | 6 +----- 3 files changed, 5 insertions(+), 27 deletions(-) diff --git a/plugins/catalog-backend/src/next/DefaultLocationService.test.ts b/plugins/catalog-backend/src/next/DefaultLocationService.test.ts index bf2bee147a..662be5d3a6 100644 --- a/plugins/catalog-backend/src/next/DefaultLocationService.test.ts +++ b/plugins/catalog-backend/src/next/DefaultLocationService.test.ts @@ -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(); }); }); diff --git a/plugins/catalog-backend/src/next/DefaultLocationService.ts b/plugins/catalog-backend/src/next/DefaultLocationService.ts index 460ba61ec8..884410c2f0 100644 --- a/plugins/catalog-backend/src/next/DefaultLocationService.ts +++ b/plugins/catalog-backend/src/next/DefaultLocationService.ts @@ -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 { - const locations = await this.store.listLocations(); - return locations.map(location => ({ data: location })); + listLocations(): Promise { + return this.store.listLocations(); } - getLocation(id: string): Promise { return this.store.getLocation(id); } diff --git a/plugins/catalog-backend/src/next/types.ts b/plugins/catalog-backend/src/next/types.ts index 05fd75522a..fbc243ce69 100644 --- a/plugins/catalog-backend/src/next/types.ts +++ b/plugins/catalog-backend/src/next/types.ts @@ -27,15 +27,11 @@ export interface LocationService { spec: LocationSpec, dryRun: boolean, ): Promise<{ location: Location; entities: Entity[] }>; - listLocations(): Promise; + listLocations(): Promise; getLocation(id: string): Promise; deleteLocation(id: string): Promise; } -export type LocationResponse = { - data: Location; -}; - export interface LocationStore { createLocation(spec: LocationSpec): Promise; listLocations(): Promise;