Backstage
    Preparing search index...

    Mock implementations of the core utility APIs, to be used in tests. Each @backstage/frontend-plugin-api#coreApis member has a matching .mock() helper. Some APIs also provide functional fake instances.

    Call .mock() to create an API whose methods are plain jest.fn() stubs without default behavior. Supply partial implementations for methods used by your test, then make assertions using Jest:

    const discovery = mockApis.discovery.mock({
    getBaseUrl: async pluginId => `http://example.com/api/${pluginId}`,
    });
    await discovery.getBaseUrl('catalog');
    expect(discovery.getBaseUrl).toHaveBeenCalledWith('catalog');

    Some APIs also provide functional fake instances, created by calling the helper directly. These maintain state or provide other useful behavior:

    const toast = mockApis.toast();
    toast.post({ title: 'Saved' });
    expect(toast.getToasts()).toEqual([{ title: 'Saved' }]);
    alert
    analytics
    appLanguage
    appLifecycle
    appTheme
    appTree
    config
    dialog
    discovery
    error
    featureFlags
    fetch
    icons
    identity
    oauthRequest
    permission
    pluginHeaderActions
    pluginWrapper
    routeResolution
    storage
    swappableComponents
    toast
    translation
    alert
    analytics
    appLanguage
    appLifecycle
    appTheme
    config
    discovery
    error
    featureFlags
    fetch
    icons
    identity
    oauthRequest
    permission
    pluginHeaderActions
    storage
    toast
    translation