diff --git a/packages/core-app-api/src/routing/RouteTracker.test.tsx b/packages/core-app-api/src/routing/RouteTracker.test.tsx new file mode 100644 index 0000000000..9472b523aa --- /dev/null +++ b/packages/core-app-api/src/routing/RouteTracker.test.tsx @@ -0,0 +1,115 @@ +/* + * Copyright 2023 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { TestApiProvider } from '@backstage/test-utils'; +import React from 'react'; +import { BackstageRouteObject } from './types'; +import { fireEvent, render, waitFor } from '@testing-library/react'; +import { RouteTracker } from './RouteTracker'; +import { Link, MemoryRouter, Route, Routes } from 'react-router-dom'; +import { + AnalyticsApi, + analyticsApiRef, + createRouteRef, +} from '@backstage/core-plugin-api'; + +describe('RouteTracker', () => { + const routeRef1 = createRouteRef({ + id: 'route1', + }); + const routeRef2 = createRouteRef({ + id: 'route2', + }); + + const routeObjects: BackstageRouteObject[] = [ + { + path: '/path/:p1/:p2', + element: go, + routeRefs: new Set([routeRef1]), + caseSensitive: false, + }, + { + path: '/path2/:param', + element: