Skip to content

Commit

Permalink
Fix client-side renderApp test
Browse files Browse the repository at this point in the history
- it was breaking on the new sendTelemetry helper (http.catch specifically, leading me to think http/context isn't being populated)
- For now, I simply mocked the SendAppSearchTelemetry component to an empty state and listened for it being called
  • Loading branch information
cee-chen committed Apr 28, 2020
1 parent c89ab55 commit dcbf2e3
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,19 @@
import { coreMock } from 'src/core/public/mocks';
import { renderApp } from '../applications';

jest.mock('./shared/telemetry', () => ({
SendAppSearchTelemetry: jest.fn(() => null),
}));
import { SendAppSearchTelemetry } from './shared/telemetry';

describe('renderApp', () => {
it('mounts and unmounts UI', () => {
const params = coreMock.createAppMountParamters();
const core = coreMock.createStart();

const unmount = renderApp(core, params, {});
expect(params.element.querySelector('.setup-guide')).not.toBeNull();
expect(SendAppSearchTelemetry).toHaveBeenCalled();
unmount();
expect(params.element.innerHTML).toEqual('');
});
Expand Down

0 comments on commit dcbf2e3

Please sign in to comment.