backend-test-utils: renamed mockServices.config to .rootConfig

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2023-08-01 12:07:07 +02:00
parent cbfecda844
commit 870c48f54f
5 changed files with 19 additions and 19 deletions
@@ -37,7 +37,7 @@ describe('myPlugin', () => {
const { server } = await startTestBackend({
features: [myPlugin()],
services: [mockServices.config.factory({ data: fakeConfig })],
services: [mockServices.rootConfig.factory({ data: fakeConfig })],
});
const response = await request(server).get('/api/example/get-value');
+13 -13
View File
@@ -36,19 +36,6 @@ export namespace mockServices {
factory: () => ServiceFactory<CacheService, 'plugin'>;
}
// (undocumented)
export function config(options?: config.Options): RootConfigService;
// (undocumented)
export namespace config {
// (undocumented)
export type Options = {
data?: JsonObject;
};
const // (undocumented)
factory: (
options?: Options | undefined,
) => ServiceFactory<RootConfigService, 'root'>;
}
// (undocumented)
export namespace database {
const // (undocumented)
factory: () => ServiceFactory<DatabaseService, 'plugin'>;
@@ -83,6 +70,19 @@ export namespace mockServices {
factory: () => ServiceFactory<PermissionsService, 'plugin'>;
}
// (undocumented)
export function rootConfig(options?: rootConfig.Options): RootConfigService;
// (undocumented)
export namespace rootConfig {
// (undocumented)
export type Options = {
data?: JsonObject;
};
const // (undocumented)
factory: (
options?: Options | undefined,
) => ServiceFactory<RootConfigService, 'root'>;
}
// (undocumented)
export namespace rootLifecycle {
const // (undocumented)
factory: () => ServiceFactory<RootLifecycleService, 'root'>;
@@ -61,13 +61,13 @@ function simpleFactory<
* @public
*/
export namespace mockServices {
export function config(options?: config.Options): RootConfigService {
export function rootConfig(options?: rootConfig.Options): RootConfigService {
return new ConfigReader(options?.data, 'mock-config');
}
export namespace config {
export namespace rootConfig {
export type Options = { data?: JsonObject };
export const factory = simpleFactory(coreServices.rootConfig, config);
export const factory = simpleFactory(coreServices.rootConfig, rootConfig);
}
export function rootLogger(options?: rootLogger.Options): LoggerService {
@@ -73,7 +73,7 @@ export interface TestBackend extends Backend {
const defaultServiceFactories = [
mockServices.cache.factory(),
mockServices.config.factory(),
mockServices.rootConfig.factory(),
mockServices.database.factory(),
mockServices.httpRouter.factory(),
mockServices.identity.factory(),
@@ -56,7 +56,7 @@ describe('catalogModuleBitbucketCloudEntityProvider', () => {
[eventsExtensionPoint, eventsExtensionPointImpl],
],
services: [
mockServices.config.factory({
mockServices.rootConfig.factory({
data: {
catalog: {
providers: {