Skip to content
This repository has been archived by the owner on Aug 9, 2022. It is now read-only.

Fix Warning on Report Details Test #156

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,9 @@ exports[`<ReportDetails /> panel render on-demand component 1`] = `
>
<h2
class="euiTitle euiTitle--medium"
/>
>
test create report definition trigger
</h2>
</div>
</div>
</div>
Expand Down Expand Up @@ -538,7 +540,9 @@ exports[`<ReportDetails /> panel render on-demand component 1`] = `
</dt>
<dd
class="euiDescriptionList__description"
/>
>
test create report definition trigger
</dd>
</dl>
</div>
<div
Expand All @@ -554,7 +558,9 @@ exports[`<ReportDetails /> panel render on-demand component 1`] = `
</dt>
<dd
class="euiDescriptionList__description"
/>
>
</dd>
</dl>
</div>
<div
Expand All @@ -570,7 +576,9 @@ exports[`<ReportDetails /> panel render on-demand component 1`] = `
</dt>
<dd
class="euiDescriptionList__description"
/>
>
</dd>
</dl>
</div>
<div
Expand All @@ -586,7 +594,9 @@ exports[`<ReportDetails /> panel render on-demand component 1`] = `
</dt>
<dd
class="euiDescriptionList__description"
/>
>
</dd>
</dl>
</div>
</div>
Expand All @@ -612,10 +622,12 @@ exports[`<ReportDetails /> panel render on-demand component 1`] = `
>
<a
class="euiLink euiLink--primary"
href="localhostundefined"
href="localhosthttp://localhost:5601/app/kibana#/dashboard/7adfa750-4c81-11e8-b3d7-01146121b73d?_g=(time:(from:'2020-10-23T20:53:35.315Z',to:'2020-10-23T21:23:35.316Z'))"
rel="noopener noreferrer"
target="_blank"
/>
>
Dashboard
</a>
</dd>
</dl>
</div>
Expand All @@ -632,7 +644,9 @@ exports[`<ReportDetails /> panel render on-demand component 1`] = `
</dt>
<dd
class="euiDescriptionList__description"
/>
>
10/23/2020, 1:53:35 PM -&gt; 10/23/2020, 2:23:35 PM
</dd>
</dl>
</div>
<div
Expand Down Expand Up @@ -779,7 +793,9 @@ exports[`<ReportDetails /> panel render on-demand component 1`] = `
</dt>
<dd
class="euiDescriptionList__description"
/>
>
On demand
</dd>
</dl>
</div>
<div
Expand All @@ -795,7 +811,9 @@ exports[`<ReportDetails /> panel render on-demand component 1`] = `
</dt>
<dd
class="euiDescriptionList__description"
/>
>
</dd>
</dl>
</div>
<div
Expand All @@ -811,7 +829,9 @@ exports[`<ReportDetails /> panel render on-demand component 1`] = `
</dt>
<dd
class="euiDescriptionList__description"
/>
>
</dd>
</dl>
</div>
<div
Expand Down Expand Up @@ -856,7 +876,9 @@ exports[`<ReportDetails /> panel render on-demand component 1`] = `
</dt>
<dd
class="euiDescriptionList__description"
/>
>
</dd>
</dl>
</div>
<div
Expand All @@ -872,7 +894,9 @@ exports[`<ReportDetails /> panel render on-demand component 1`] = `
</dt>
<dd
class="euiDescriptionList__description"
/>
>
</dd>
</dl>
</div>
<div
Expand All @@ -888,7 +912,11 @@ exports[`<ReportDetails /> panel render on-demand component 1`] = `
</dt>
<dd
class="euiDescriptionList__description"
/>
>
<p>
</p>
</dd>
</dl>
</div>
<div
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ import httpClientMock from '../../../../../test/httpMockClient';
import 'babel-polyfill';
import { act } from 'react-dom/test-utils';

function setBreadcrumbs(array: []) {
jest.fn();
}

describe('<ReportDetails /> panel', () => {
const match = {
params: {
Expand All @@ -40,7 +44,7 @@ describe('<ReportDetails /> panel', () => {
report_format: '',
header: '',
footer: '',
time_duration: '',
time_duration: 'PT30M',
},
},
delivery: {
Expand All @@ -54,17 +58,19 @@ describe('<ReportDetails /> panel', () => {

httpClientMock.get = jest.fn().mockResolvedValue({
report_definition,
query_url: `http://localhost:5601/app/kibana#/dashboard/7adfa750-4c81-11e8-b3d7-01146121b73d?_g=(time:(from:'2020-10-23T20:53:35.315Z',to:'2020-10-23T21:23:35.316Z'))`,
});

const { container } = await render(
const { container } = render(
<ReportDetails
httpClient={httpClientMock}
props={propsMock}
match={match}
setBreadcrumbs={setBreadcrumbs}
/>
);
await expect(container.firstChild).toMatchSnapshot();
await act(() => promise);
await expect(container.firstChild).toMatchSnapshot();
});

test('render 5 hours recurring component', async () => {
Expand All @@ -79,7 +85,7 @@ describe('<ReportDetails /> panel', () => {
report_format: '',
header: '',
footer: '',
time_duration: '',
time_duration: 'PT30M',
},
},
delivery: {
Expand Down Expand Up @@ -108,14 +114,15 @@ describe('<ReportDetails /> panel', () => {
query_url: `http://localhost:5601/app/kibana#/dashboard/7adfa750-4c81-11e8-b3d7-01146121b73d?_g=(time:(from:'2020-10-23T20:53:35.315Z',to:'2020-10-23T21:23:35.316Z'))`,
});

const { container } = await render(
const { container } = render(
<ReportDetails
httpClient={httpClientMock}
props={propsMock}
match={match}
setBreadcrumbs={setBreadcrumbs}
/>
);
await expect(container.firstChild).toMatchSnapshot();
await act(() => promise);
await expect(container.firstChild).toMatchSnapshot();
});
});