Backstage
    Preparing search index...

    MockConfigApi is a thin wrapper around @backstage/config#ConfigReader that can be used to mock configuration using a plain object.

    const mockConfig = new MockConfigApi({
    data: { app: { baseUrl: 'https://example.com' } },
    });

    const rendered = await renderInTestApp(
    <TestApiProvider apis={[[configApiRef, mockConfig]]}>
    <MyTestedComponent />
    </TestApiProvider>,
    );
    interface MockConfigApi {
        get<T = JsonValue>(key?: string): T;
        getBoolean(key: string): boolean;
        getConfig(key: string): Config;
        getConfigArray(key: string): Config[];
        getNumber(key: string): number;
        getOptional<T = JsonValue>(key?: string): T | undefined;
        getOptionalBoolean(key: string): boolean | undefined;
        getOptionalConfig(key: string): Config | undefined;
        getOptionalConfigArray(key: string): Config[] | undefined;
        getOptionalNumber(key: string): number | undefined;
        getOptionalString(key: string): string | undefined;
        getOptionalStringArray(key: string): string[] | undefined;
        getString(key: string): string;
        getStringArray(key: string): string[];
        has(key: string): boolean;
        keys(): string[];
    }

    Implements

    Index

    Methods