mirror of
https://github.com/grafana/grafana.git
synced 2025-08-02 23:53:10 +08:00
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:
@ -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>
|
||||
|
Reference in New Issue
Block a user