Add MockAlertApi and MockFeatureFlagsApi to frontend-test-utils

Introduces comprehensive mock implementations for AlertApi and FeatureFlagsApi in @backstage/frontend-test-utils, following the 3-pattern approach (function, factory, mock) for consistency with existing test utilities.

The new mocks include useful testing methods:
- MockAlertApi: clearAlerts(), waitForAlert(), getAlerts()
- MockFeatureFlagsApi: getState(), setState(), clearState()

Also adds a mockApis namespace that provides these new mocks and re-exports existing mockApis from @backstage/test-utils for backwards compatibility.

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2026-02-04 22:42:24 +01:00
parent be7c1d73b2
commit d2ac2ec49d
13 changed files with 929 additions and 3 deletions
@@ -39,12 +39,14 @@
"@backstage/test-utils": "workspace:^",
"@backstage/types": "workspace:^",
"@backstage/version-bridge": "workspace:^",
"zen-observable": "^0.10.0",
"zod": "^3.25.76"
},
"devDependencies": {
"@backstage/cli": "workspace:^",
"@testing-library/jest-dom": "^6.0.0",
"@types/react": "^18.0.0",
"@types/zen-observable": "^0.8.0",
"react": "^18.0.2",
"react-dom": "^18.0.2",
"react-router-dom": "^6.30.2"