From 3b0c46e272b32e7b7410021b209298b4970ad43d Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Thu, 5 Mar 2026 13:56:51 +0100 Subject: [PATCH] deprecate MockFetchApi class, keep MockFetchApiOptions Signed-off-by: Patrik Oldsberg Made-with: Cursor --- .changeset/deprecate-mock-api-classes.md | 2 +- packages/frontend-test-utils/report.api.md | 2 +- packages/frontend-test-utils/src/apis/FetchApi/MockFetchApi.ts | 1 + packages/frontend-test-utils/src/apis/index.ts | 1 + 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.changeset/deprecate-mock-api-classes.md b/.changeset/deprecate-mock-api-classes.md index 0b27b3dfd3..8aac45bc1f 100644 --- a/.changeset/deprecate-mock-api-classes.md +++ b/.changeset/deprecate-mock-api-classes.md @@ -2,4 +2,4 @@ '@backstage/frontend-test-utils': patch --- -Deprecated standalone mock API exports in favor of the `mockApis` namespace. This includes the mock classes (`MockAlertApi`, `MockAnalyticsApi`, `MockConfigApi`, `MockErrorApi`, `MockFeatureFlagsApi`, `MockPermissionApi`, `MockStorageApi`, `MockTranslationApi`), their option types (`MockErrorApiOptions`, `MockFeatureFlagsApiOptions`), and the `ErrorWithContext` type. `MockFetchApi`, `MockFetchApiOptions` are kept as non-deprecated exports. Use the `mockApis` namespace instead, for example `mockApis.alert()` or `mockApis.alert.mock()`. +Deprecated standalone mock API exports in favor of the `mockApis` namespace. This includes the mock classes (`MockAlertApi`, `MockAnalyticsApi`, `MockConfigApi`, `MockErrorApi`, `MockFetchApi`, `MockFeatureFlagsApi`, `MockPermissionApi`, `MockStorageApi`, `MockTranslationApi`), their option types (`MockErrorApiOptions`, `MockFeatureFlagsApiOptions`), and the `ErrorWithContext` type. `MockFetchApiOptions` is kept as a non-deprecated export. Use the `mockApis` namespace instead, for example `mockApis.alert()` or `mockApis.alert.mock()`. diff --git a/packages/frontend-test-utils/report.api.md b/packages/frontend-test-utils/report.api.md index 1b25079347..6d9f8964b1 100644 --- a/packages/frontend-test-utils/report.api.md +++ b/packages/frontend-test-utils/report.api.md @@ -344,7 +344,7 @@ export interface MockFeatureFlagsApiOptions { initialStates?: Record; } -// @public +// @public @deprecated export class MockFetchApi implements FetchApi { constructor(options?: MockFetchApiOptions); get fetch(): typeof fetch; diff --git a/packages/frontend-test-utils/src/apis/FetchApi/MockFetchApi.ts b/packages/frontend-test-utils/src/apis/FetchApi/MockFetchApi.ts index b61ca680d1..0ea06924f0 100644 --- a/packages/frontend-test-utils/src/apis/FetchApi/MockFetchApi.ts +++ b/packages/frontend-test-utils/src/apis/FetchApi/MockFetchApi.ts @@ -89,6 +89,7 @@ export interface MockFetchApiOptions { * A test helper implementation of {@link @backstage/core-plugin-api#FetchApi}. * * @public + * @deprecated Use `mockApis.fetch()` instead. */ export class MockFetchApi implements FetchApi { private readonly implementation: FetchApi; diff --git a/packages/frontend-test-utils/src/apis/index.ts b/packages/frontend-test-utils/src/apis/index.ts index 41cd3a3bbf..cee5c47635 100644 --- a/packages/frontend-test-utils/src/apis/index.ts +++ b/packages/frontend-test-utils/src/apis/index.ts @@ -66,6 +66,7 @@ export type { ErrorWithContext } from './ErrorApi/MockErrorApi'; /** * @public + * @deprecated Use `mockApis.fetch()` instead. */ export type { MockFetchApi } from './FetchApi';