grafana/public/app/core/navigation/GrafanaRoute.test.tsx
Dominik Prokop 663a8935f7
User analytics: Add Rudderstack integration (#36567)
* Replace analytics service with Echo backend

* Add Rudderstack integration and general pageview and interaction Echo events

* Update conf/defaults.ini

Co-authored-by: Dan Cech <dcech@grafana.com>

* Update packages/grafana-runtime/src/types/analytics.ts

Co-authored-by: Dan Cech <dcech@grafana.com>

* Update conf/defaults.ini

Co-authored-by: Dan Cech <dcech@grafana.com>

* Update tests

* Force cla check

Co-authored-by: Dan Cech <dcech@grafana.com>
2021-07-09 11:45:25 +02:00

30 lines
801 B
TypeScript

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');
});
});