From ac993deb18d2dda8668bc89e15ebf60313630bb9 Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Tue, 10 Jan 2023 15:17:05 +0100 Subject: [PATCH] backend-test-utils: tweak mockConfigFactory options MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Fredrik Adelöw Co-authored-by: blam Co-authored-by: Johan Haals Signed-off-by: Patrik Oldsberg --- packages/backend-test-utils/package.json | 1 + .../src/next/implementations/mockConfigService.ts | 7 ++++--- yarn.lock | 1 + 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/backend-test-utils/package.json b/packages/backend-test-utils/package.json index ae96f17b8e..725be0d905 100644 --- a/packages/backend-test-utils/package.json +++ b/packages/backend-test-utils/package.json @@ -39,6 +39,7 @@ "@backstage/backend-plugin-api": "workspace:^", "@backstage/cli": "workspace:^", "@backstage/config": "workspace:^", + "@backstage/types": "workspace:^", "better-sqlite3": "^8.0.0", "express": "^4.17.1", "express-promise-router": "^4.1.0", diff --git a/packages/backend-test-utils/src/next/implementations/mockConfigService.ts b/packages/backend-test-utils/src/next/implementations/mockConfigService.ts index 976167b473..78a670585d 100644 --- a/packages/backend-test-utils/src/next/implementations/mockConfigService.ts +++ b/packages/backend-test-utils/src/next/implementations/mockConfigService.ts @@ -18,13 +18,14 @@ import { coreServices, createServiceFactory, } from '@backstage/backend-plugin-api'; -import { AppConfig, ConfigReader } from '@backstage/config'; +import { ConfigReader } from '@backstage/config'; +import { JsonObject } from '@backstage/types'; /** @public */ export const mockConfigFactory = createServiceFactory({ service: coreServices.config, deps: {}, - async factory(_, options?: { config?: AppConfig }) { - return new ConfigReader(options?.config); + async factory(_, options?: { data?: JsonObject }) { + return new ConfigReader(options?.data, 'mock-config'); }, }); diff --git a/yarn.lock b/yarn.lock index f8957bfc35..f973dee489 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3558,6 +3558,7 @@ __metadata: "@backstage/backend-plugin-api": "workspace:^" "@backstage/cli": "workspace:^" "@backstage/config": "workspace:^" + "@backstage/types": "workspace:^" "@types/supertest": ^2.0.8 better-sqlite3: ^8.0.0 express: ^4.17.1