@@ -18,10 +18,10 @@ import React from 'react';
|
||||
import { render, fireEvent } from '@testing-library/react';
|
||||
import { MockAnalyticsApi, wrapInTestApp } from '@backstage/test-utils';
|
||||
import { ApiProvider, ApiRegistry } from '@backstage/core-app-api';
|
||||
import { analyticsApiRef } from '@backstage/core-plugin-api';
|
||||
import { isExternalUri, Link } from './Link';
|
||||
import { Route, Routes } from 'react-router';
|
||||
import { act } from 'react-dom/test-utils';
|
||||
import { analyticsApiRef } from '../../../../core-plugin-api/src';
|
||||
|
||||
describe('<Link />', () => {
|
||||
it('navigates using react-router', async () => {
|
||||
|
||||
@@ -37,8 +37,6 @@ export type LinkProps = MaterialLinkProps &
|
||||
declare function LinkType(props: LinkProps): JSX.Element;
|
||||
|
||||
/**
|
||||
* Thin wrapper on top of material-ui's Link component
|
||||
* Makes the Link to utilise react-router
|
||||
* Thin wrapper on top of material-ui's Link component, which...
|
||||
* - Makes the Link use react-router
|
||||
* - Captures Link clicks as analytics events.
|
||||
|
||||
@@ -75,7 +75,7 @@ describe('SearchPage', () => {
|
||||
const expectedFilters = { [expectedFilterField]: expectedFilterValue };
|
||||
const expectedPageCursor = 'SOMEPAGE';
|
||||
|
||||
// e.g. ?query=petstore&pageCursor=1&filters[lifecycle][]=experimental&filters[kind]=Component
|
||||
// e.g. ?query=petstore&pageCursor=SOMEPAGE&filters[lifecycle][]=experimental&filters[kind]=Component
|
||||
(useLocation as jest.Mock).mockReturnValue({
|
||||
search: `?query=${expectedTerm}&types[]=${expectedTypes[0]}&filters[${expectedFilterField}]=${expectedFilterValue}&pageCursor=${expectedPageCursor}`,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user