Fix type issues in existing tests

Signed-off-by: Eric Peterson <ericpeterson@spotify.com>
This commit is contained in:
Eric Peterson
2023-06-05 16:03:26 +02:00
parent fbb24d0134
commit 34f54060f2
4 changed files with 26 additions and 4 deletions
@@ -21,6 +21,7 @@ import {
ExternalRouteRef,
RouteRef,
SubRouteRef,
BackstagePlugin,
} from '@backstage/core-plugin-api';
import { RouteResolver } from './RouteResolver';
import { MATCH_ALL_ROUTE } from './collectors';
@@ -31,7 +32,12 @@ jest.mock('react-router-dom', () =>
);
const element = () => null;
const rest = { element, caseSensitive: false, children: [MATCH_ALL_ROUTE] };
const rest = {
element,
caseSensitive: false,
children: [MATCH_ALL_ROUTE],
plugins: new Set<BackstagePlugin>(),
};
const ref1 = createRouteRef({ id: 'rr1' });
const ref2 = createRouteRef({ id: 'rr2', params: ['x'] });
@@ -21,11 +21,17 @@ import {
ExternalRouteRef,
RouteRef,
SubRouteRef,
BackstagePlugin,
} from '@backstage/core-plugin-api';
import { MATCH_ALL_ROUTE } from './collectors';
const element = () => null;
const rest = { element, caseSensitive: false, children: [MATCH_ALL_ROUTE] };
const rest = {
element,
caseSensitive: false,
children: [MATCH_ALL_ROUTE],
plugins: new Set<BackstagePlugin>(),
};
const ref1 = createRouteRef({ id: 'rr1' });
const ref2 = createRouteRef({ id: 'rr2', params: ['x'] });
@@ -21,6 +21,7 @@ import {
ExternalRouteRef,
RouteRef,
SubRouteRef,
BackstagePlugin,
} from '@backstage/core-plugin-api';
import { RouteResolver } from './RouteResolver';
import { MATCH_ALL_ROUTE } from './collectors';
@@ -31,7 +32,12 @@ jest.mock('react-router-dom', () =>
);
const element = () => null;
const rest = { element, caseSensitive: false, children: [MATCH_ALL_ROUTE] };
const rest = {
element,
caseSensitive: false,
children: [MATCH_ALL_ROUTE],
plugins: new Set<BackstagePlugin>(),
};
const ref1 = createRouteRef({ id: 'rr1' });
const ref2 = createRouteRef({ id: 'rr2', params: ['x'] });
@@ -22,6 +22,7 @@ import { Link, MemoryRouter, Route, Routes } from 'react-router-dom';
import {
AnalyticsApi,
analyticsApiRef,
createPlugin,
createRouteRef,
} from '@backstage/core-plugin-api';
@@ -32,18 +33,21 @@ describe('RouteTracker', () => {
const routeRef2 = createRouteRef({
id: 'route2',
});
const plugin1 = createPlugin({ id: 'plugin1' });
const routeObjects: BackstageRouteObject[] = [
{
path: '/path/:p1/:p2',
element: <Link to="/path2/hello">go</Link>,
routeRefs: new Set([routeRef1]),
plugins: new Set([plugin1]),
caseSensitive: false,
},
{
path: '/path2/:param',
element: <div>hi there</div>,
routeRefs: new Set([routeRef2]),
plugins: new Set(),
caseSensitive: false,
},
];
@@ -73,7 +77,7 @@ describe('RouteTracker', () => {
},
context: {
extension: 'App',
pluginId: 'root',
pluginId: 'plugin1',
routeRef: 'route1',
},
subject: '/path/foo/bar',