Skip to main content
Version: Next

ApiMock

Home > @backstage/test-utils > ApiMock

Represents a mocked version of an API, where you automatically have access to the mocked versions of all of its methods along with a factory that returns that same mock.

Signature:

export type ApiMock<TApi> = {
factory: ApiFactory<TApi, TApi, {}>;
} & {
[Key in keyof TApi]: TApi[Key] extends (...args: infer Args) => infer Return ? TApi[Key] & jest.MockInstance<Return, Args> : TApi[Key];
};

References: ApiFactory