docs: update to prefer new apis option and use mockApis

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2026-02-01 21:09:24 +01:00
parent 09032d7bd4
commit 68d2c57d94
3 changed files with 65 additions and 89 deletions
@@ -83,15 +83,16 @@ export type TestAppOptions<TApiPairs extends any[] = any[]> = {
initialRouteEntries?: string[];
/**
* API overrides to provide to the test app.
* API overrides to provide to the test app. Use `mockApis` helpers
* from `@backstage/frontend-test-utils` to create mock implementations.
*
* @example
* ```ts
* import { identityApiRef } from '@backstage/frontend-plugin-api';
* import { mockApis } from '@backstage/frontend-test-utils';
*
* renderInTestApp(<MyComponent />, {
* apis: [
* [errorApiRef, mockErrorApi],
* [analyticsApiRef, mockAnalyticsApi],
* ]
* apis: [[identityApiRef, mockApis.identity({ userEntityRef: 'user:default/guest' })]],
* })
* ```
*/