You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
801 B
29 lines
801 B
import React from 'react';
|
|
import { render } from '@testing-library/react';
|
|
import { GrafanaRoute } from './GrafanaRoute';
|
|
import { setEchoSrv } from '@grafana/runtime';
|
|
import { Echo } from '../services/echo/Echo';
|
|
|
|
describe('GrafanaRoute', () => {
|
|
beforeEach(() => {
|
|
setEchoSrv(new Echo());
|
|
});
|
|
|
|
it('Parses search', () => {
|
|
let capturedProps: any;
|
|
const PageComponent = (props: any) => {
|
|
capturedProps = props;
|
|
return <div />;
|
|
};
|
|
|
|
const location = { search: '?query=hello&test=asd' } as any;
|
|
const history = {} as any;
|
|
const match = {} as any;
|
|
|
|
render(
|
|
<GrafanaRoute location={location} history={history} match={match} route={{ component: PageComponent } as any} />
|
|
);
|
|
|
|
expect(capturedProps.queryParams.query).toBe('hello');
|
|
});
|
|
});
|
|
|