diff --git a/.changeset/modern-mails-live.md b/.changeset/modern-mails-live.md new file mode 100644 index 0000000000..82155c44d5 --- /dev/null +++ b/.changeset/modern-mails-live.md @@ -0,0 +1,5 @@ +--- +'@backstage/frontend-test-utils': patch +--- + +Re-export mock API implementations as well as `TestApiProvider`, TestApiRegistry`, `withLogCollector`and`setupRequestMockHandlers`froom`@backstage/test-utils`. diff --git a/packages/frontend-test-utils/api-report.md b/packages/frontend-test-utils/api-report.md index 8d7837b90a..59f5696ddc 100644 --- a/packages/frontend-test-utils/api-report.md +++ b/packages/frontend-test-utils/api-report.md @@ -3,9 +3,24 @@ > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). ```ts +import { ErrorWithContext } from '@backstage/test-utils'; import { Extension } from '@backstage/frontend-plugin-api'; import { JsonObject } from '@backstage/types'; +import { MockAnalyticsApi } from '@backstage/test-utils'; +import { MockConfigApi } from '@backstage/test-utils'; +import { MockErrorApi } from '@backstage/test-utils'; +import { MockErrorApiOptions } from '@backstage/test-utils'; +import { MockFetchApi } from '@backstage/test-utils'; +import { MockFetchApiOptions } from '@backstage/test-utils'; +import { MockPermissionApi } from '@backstage/test-utils'; +import { MockStorageApi } from '@backstage/test-utils'; +import { MockStorageBucket } from '@backstage/test-utils'; import { RenderResult } from '@testing-library/react'; +import { setupRequestMockHandlers } from '@backstage/test-utils'; +import { TestApiProvider } from '@backstage/test-utils'; +import { TestApiProviderProps } from '@backstage/test-utils'; +import { TestApiRegistry } from '@backstage/test-utils'; +import { withLogCollector } from '@backstage/test-utils'; // @public (undocumented) export function createExtensionTester( @@ -15,6 +30,8 @@ export function createExtensionTester( }, ): ExtensionTester; +export { ErrorWithContext }; + // @public (undocumented) export class ExtensionTester { // (undocumented) @@ -27,4 +44,32 @@ export class ExtensionTester { // (undocumented) render(options?: { config?: JsonObject }): RenderResult; } + +export { MockAnalyticsApi }; + +export { MockConfigApi }; + +export { MockErrorApi }; + +export { MockErrorApiOptions }; + +export { MockFetchApi }; + +export { MockFetchApiOptions }; + +export { MockPermissionApi }; + +export { MockStorageApi }; + +export { MockStorageBucket }; + +export { setupRequestMockHandlers }; + +export { TestApiProvider }; + +export { TestApiProviderProps }; + +export { TestApiRegistry }; + +export { withLogCollector }; ``` diff --git a/packages/frontend-test-utils/src/apis/index.ts b/packages/frontend-test-utils/src/apis/index.ts new file mode 100644 index 0000000000..81bd8a7abd --- /dev/null +++ b/packages/frontend-test-utils/src/apis/index.ts @@ -0,0 +1,28 @@ +/* + * Copyright 2023 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export { + MockAnalyticsApi, + MockConfigApi, + type ErrorWithContext, + MockErrorApi, + type MockErrorApiOptions, + MockFetchApi, + type MockFetchApiOptions, + MockPermissionApi, + MockStorageApi, + type MockStorageBucket, +} from '@backstage/test-utils'; diff --git a/packages/frontend-test-utils/src/index.ts b/packages/frontend-test-utils/src/index.ts index 6a28cc2abe..0dab8e75b7 100644 --- a/packages/frontend-test-utils/src/index.ts +++ b/packages/frontend-test-utils/src/index.ts @@ -20,4 +20,12 @@ * Contains utilities that can be used when testing frontend features such as extensions. */ +export * from './apis'; export * from './app'; + +export { TestApiProvider, TestApiRegistry } from '@backstage/test-utils'; +export type { TestApiProviderProps } from '@backstage/test-utils'; + +export { withLogCollector } from '@backstage/test-utils'; + +export { setupRequestMockHandlers } from '@backstage/test-utils';