deprecate MockFetchApi class, keep MockFetchApiOptions

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Made-with: Cursor
This commit is contained in:
Patrik Oldsberg
2026-03-05 13:56:51 +01:00
parent ec9665666a
commit 3b0c46e272
4 changed files with 4 additions and 2 deletions
+1 -1
View File
@@ -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()`.
+1 -1
View File
@@ -344,7 +344,7 @@ export interface MockFeatureFlagsApiOptions {
initialStates?: Record<string, FeatureFlagState>;
}
// @public
// @public @deprecated
export class MockFetchApi implements FetchApi {
constructor(options?: MockFetchApiOptions);
get fetch(): typeof fetch;
@@ -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;
@@ -66,6 +66,7 @@ export type { ErrorWithContext } from './ErrorApi/MockErrorApi';
/**
* @public
* @deprecated Use `mockApis.fetch()` instead.
*/
export type { MockFetchApi } from './FetchApi';