diff --git a/.changeset/wet-seas-deliver.md b/.changeset/wet-seas-deliver.md index 0b440cbb46..f625e093f5 100644 --- a/.changeset/wet-seas-deliver.md +++ b/.changeset/wet-seas-deliver.md @@ -54,7 +54,7 @@ const apis = ApiRegistry.from([ Would be migrated to this: ```ts -const apis = TestApiRegistry.with( +const apis = TestApiRegistry.from( [identityApiRef, mockIdentityApi], [configApiRef, new ConfigReader({})], ); diff --git a/packages/core-components/src/components/DismissableBanner/DismissableBanner.test.tsx b/packages/core-components/src/components/DismissableBanner/DismissableBanner.test.tsx index 50b1fd33eb..e62b3fa82d 100644 --- a/packages/core-components/src/components/DismissableBanner/DismissableBanner.test.tsx +++ b/packages/core-components/src/components/DismissableBanner/DismissableBanner.test.tsx @@ -35,7 +35,7 @@ describe('', () => { }; beforeEach(() => { - apis = TestApiRegistry.with([storageApiRef, createWebStorage()]); + apis = TestApiRegistry.from([storageApiRef, createWebStorage()]); }); it('renders the message and the popover', async () => { diff --git a/packages/test-utils/api-report.md b/packages/test-utils/api-report.md index 5bb552563b..a1f22a7a64 100644 --- a/packages/test-utils/api-report.md +++ b/packages/test-utils/api-report.md @@ -193,7 +193,7 @@ export type TestApiProviderProps = { export class TestApiRegistry implements ApiHolder { // (undocumented) get(api: ApiRef): T | undefined; - static with( + static from( ...apis: readonly [...TestApiProviderPropsApiPairs] ): TestApiRegistry; } diff --git a/packages/test-utils/src/testUtils/TestApiProvider.test.tsx b/packages/test-utils/src/testUtils/TestApiProvider.test.tsx index 7bffd39a4a..d3f84f854a 100644 --- a/packages/test-utils/src/testUtils/TestApiProvider.test.tsx +++ b/packages/test-utils/src/testUtils/TestApiProvider.test.tsx @@ -98,7 +98,7 @@ describe('TestApiRegistry', () => { it('should be created with APIs', () => { const x = { a: 'a', b: 3 }; const y = 'y'; - const registry = TestApiRegistry.with([xApiRef, x], [yApiRef, y]); + const registry = TestApiRegistry.from([xApiRef, x], [yApiRef, y]); expect(registry.get(xApiRef)).toBe(x); expect(registry.get(yApiRef)).toBe(y); @@ -106,7 +106,7 @@ describe('TestApiRegistry', () => { it('should allow partial implementations', () => { const x = { a: 'a' }; - const registry = TestApiRegistry.with([xApiRef, x]); + const registry = TestApiRegistry.from([xApiRef, x]); expect(registry.get(xApiRef)).toBe(x); expect(registry.get(yApiRef)).toBeUndefined(); @@ -115,7 +115,7 @@ describe('TestApiRegistry', () => { it('should require partial implementations to match types', () => { const x = { a: 2 }; // @ts-expect-error - const registry = TestApiRegistry.with([xApiRef, x]); + const registry = TestApiRegistry.from([xApiRef, x]); expect(registry.get(xApiRef)).toBe(x); expect(registry.get(yApiRef)).toBeUndefined(); @@ -125,7 +125,7 @@ describe('TestApiRegistry', () => { const x1 = { a: 'a' }; const x2 = { a: 's' }; const x3 = { a: 'd' }; - const registry = TestApiRegistry.with( + const registry = TestApiRegistry.from( [xApiRef, x1], [xApiRef, x2], [xApiRef, x3], diff --git a/packages/test-utils/src/testUtils/TestApiProvider.tsx b/packages/test-utils/src/testUtils/TestApiProvider.tsx index 92be0ffd77..43774b7267 100644 --- a/packages/test-utils/src/testUtils/TestApiProvider.tsx +++ b/packages/test-utils/src/testUtils/TestApiProvider.tsx @@ -63,7 +63,7 @@ export class TestApiRegistry implements ApiHolder { * @public * @param apis - A list of pairs mapping an ApiRef to its respective implementation. */ - static with( + static from( ...apis: readonly [...TestApiProviderPropsApiPairs] ) { return new TestApiRegistry( @@ -121,6 +121,6 @@ export const TestApiProvider = ({ children, }: TestApiProviderProps) => { return ( - + ); };