Routing: Add CompatRouter to tests (#92114)

* Add CompatRouter

* Fix tests

* Add CompatRouter to TestProvider

* Use findBy

* Remove AppChromeService

* Remove historyOptions

* Routing: Fix alerting/test utils issues from react compat router usage (#92127)

---------

Co-authored-by: Tom Ratcliffe <tom.ratcliffe@grafana.com>
This commit is contained in:
Alex Khomenko
2024-08-22 13:05:12 +03:00
committed by GitHub
parent 7bee9d5e0f
commit 022892ef72
7 changed files with 34 additions and 30 deletions

View File

@ -2,6 +2,7 @@ import { Store } from '@reduxjs/toolkit';
import * as React from 'react';
import { Provider } from 'react-redux';
import { Router } from 'react-router-dom';
import { CompatRouter } from 'react-router-dom-v5-compat';
import { getGrafanaContextMock } from 'test/mocks/getGrafanaContextMock';
import { locationService } from '@grafana/runtime';
@ -35,8 +36,10 @@ export function TestProvider(props: Props) {
<Provider store={store}>
<Router history={locationService.getHistory()}>
<ModalsContextProvider>
<GrafanaContext.Provider value={context}>{children}</GrafanaContext.Provider>
<ModalRoot />
<CompatRouter>
<GrafanaContext.Provider value={context}>{children}</GrafanaContext.Provider>
<ModalRoot />
</CompatRouter>
</ModalsContextProvider>
</Router>
</Provider>