diff --git a/.changeset/wet-seas-deliver.md b/.changeset/wet-seas-deliver.md index f625e093f5..da5679eb8e 100644 --- a/.changeset/wet-seas-deliver.md +++ b/.changeset/wet-seas-deliver.md @@ -31,7 +31,7 @@ render( ) ``` -In cases where the `ApiProvider` is used in a more standalone way, for example to reuse a set of APIs across multiple tests, the `TestApiRegistry` can be used instead. Note that the `TestApiRegistry` only has a single static factory method, `.with()`, and it is slightly different from the existing `.with()` method on `ApiRegistry`. +In cases where the `ApiProvider` is used in a more standalone way, for example to reuse a set of APIs across multiple tests, the `TestApiRegistry` can be used instead. Note that the `TestApiRegistry` only has a single static factory method, `.from()`, and it is slightly different from the existing `.from()` method on `ApiRegistry` in that it doesn't require the API pairs to be wrapped in an outer array. Usage that looks like this: diff --git a/packages/test-utils/src/testUtils/TestApiProvider.test.tsx b/packages/test-utils/src/testUtils/TestApiProvider.test.tsx index d3f84f854a..1b981b15ec 100644 --- a/packages/test-utils/src/testUtils/TestApiProvider.test.tsx +++ b/packages/test-utils/src/testUtils/TestApiProvider.test.tsx @@ -16,9 +16,8 @@ import React from 'react'; import { createApiRef, useApiHolder } from '@backstage/core-plugin-api'; -import { TestApiProvider } from './TestApiProvider'; +import { TestApiProvider, TestApiRegistry } from './TestApiProvider'; import { render, screen } from '@testing-library/react'; -import { TestApiRegistry } from '.'; const xApiRef = createApiRef<{ a: string; b: number }>({ id: 'x', diff --git a/packages/test-utils/src/testUtils/TestApiProvider.tsx b/packages/test-utils/src/testUtils/TestApiProvider.tsx index 4408fc5b36..b1499b0cde 100644 --- a/packages/test-utils/src/testUtils/TestApiProvider.tsx +++ b/packages/test-utils/src/testUtils/TestApiProvider.tsx @@ -54,7 +54,7 @@ export class TestApiRegistry implements ApiHolder { * * @example * ```ts - * const apis = TestApiRegistry.with( + * const apis = TestApiRegistry.from( * [configApiRef, new ConfigReader({})], * [identityApiRef, { getUserId: () => 'tester' }], * );