Skip to main content
Version: Next

MockConfigApi

Home > @backstage/test-utils > MockConfigApi

Warning: This API is now obsolete.

Use mockApis.config instead

MockConfigApi is a thin wrapper around ConfigReader that can be used to mock configuration using a plain object.

Signature:

class MockConfigApi implements ConfigApi 

Implements: ConfigApi

Example

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

const rendered = await renderInTestApp(
<TestApiProvider apis={[[configApiRef, mockConfig]]}>
<MyTestedComponent />
</TestApiProvider>,
);

Constructors

Constructor

Modifiers

Description

(constructor)(data)

Constructs a new instance of the MockConfigApi class

Methods

Method

Modifiers

Description

get(key)

getBoolean(key)

getConfig(key)

getConfigArray(key)

getNumber(key)

getOptional(key)

getOptionalBoolean(key)

getOptionalConfig(key)

getOptionalConfigArray(key)

getOptionalNumber(key)

getOptionalString(key)

getOptionalStringArray(key)

getString(key)

getStringArray(key)

has(key)

keys()