core-app-api: make beta tests use beta version

Co-authored-by: Fredrik Adelöw <freben@gmail.com>
Co-authored-by: blam <ben@blam.sh>
Co-authored-by: Johan Haals <johan.haals@gmail.com>
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2022-08-23 17:08:25 +02:00
parent 91fb4600e7
commit 73ef4bd581
4 changed files with 20 additions and 0 deletions
@@ -24,6 +24,11 @@ import { AppContextProvider } from '../app/AppContext';
import { FlatRoutes } from './FlatRoutes';
import { TestApiProvider } from '@backstage/test-utils';
jest.mock('react-router', () => jest.requireActual('react-router-beta'));
jest.mock('react-router-dom', () =>
jest.requireActual('react-router-dom-beta'),
);
const mockFeatureFlagsApi = new LocalStorageFeatureFlags();
const Wrapper = ({ children }: { children?: React.ReactNode }) => (
<TestApiProvider apis={[[featureFlagsApiRef, mockFeatureFlagsApi]]}>
@@ -25,6 +25,11 @@ import {
import { RouteResolver } from './RouteResolver';
import { MATCH_ALL_ROUTE } from './collectors';
jest.mock('react-router', () => jest.requireActual('react-router-beta'));
jest.mock('react-router-dom', () =>
jest.requireActual('react-router-dom-beta'),
);
const element = () => null;
const rest = { element, caseSensitive: false, children: [MATCH_ALL_ROUTE] };
@@ -40,6 +40,11 @@ import { RouteResolver } from './RouteResolver';
import { AnyRouteRef, RouteFunc } from './types';
import { AppContextProvider } from '../app/AppContext';
jest.mock('react-router', () => jest.requireActual('react-router-beta'));
jest.mock('react-router-dom', () =>
jest.requireActual('react-router-dom-beta'),
);
const MockComponent = ({ children }: PropsWithChildren<{ path?: string }>) => (
<>{children}</>
);
@@ -32,6 +32,11 @@ import {
} from '@backstage/core-plugin-api';
import { MemoryRouter, Routes, Route } from 'react-router-dom';
jest.mock('react-router', () => jest.requireActual('react-router-beta'));
jest.mock('react-router-dom', () =>
jest.requireActual('react-router-dom-beta'),
);
const MockComponent = ({ children }: PropsWithChildren<{ path?: string }>) => (
<>{children}</>
);