Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update jest unit tests #112

Merged
merged 53 commits into from
Sep 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
020ba9a
Update .opensearch_dashboards-plugin-helpers.json
Apr 30, 2021
bb4e658
Merge branch 'opensearch-project:main' into main
annie3431 Jul 14, 2021
969e1ef
Merge remote-tracking branch 'upstream/main' into main
Sep 1, 2021
6ef529e
Merge remote-tracking branch 'upstream/main' into main
Sep 1, 2021
073ed2a
Merge remote-tracking branch 'upstream/main' into main
Sep 1, 2021
2939af6
Merge remote-tracking branch 'upstream/main' into main
Sep 1, 2021
226e6f0
Merge remote-tracking branch 'upstream/main' into main
Sep 2, 2021
2591fb1
Merge remote-tracking branch 'upstream/main' into main
Sep 2, 2021
4f9d47f
Merge remote-tracking branch 'upstream/main' into main
Sep 2, 2021
dad0337
Merge remote-tracking branch 'upstream/main' into main
Sep 2, 2021
ca47b65
Merge remote-tracking branch 'upstream/main' into main
Sep 2, 2021
9d0e30c
Merge remote-tracking branch 'upstream/main' into main
Sep 2, 2021
1c57134
Merge remote-tracking branch 'upstream/main' into main
Sep 2, 2021
e2b66aa
Merge remote-tracking branch 'upstream/main' into main
Sep 2, 2021
3258eb7
Update snapshots
Sep 2, 2021
66f1eb4
Update whereExpression.test and some snapshots
Sep 2, 2021
e2da98e
Update whereExpression.test and some snapshots
Sep 3, 2021
c433382
Merge remote-tracking branch 'upstream/main' into main
Sep 2, 2021
0497467
Merge branch 'jest-update' of https://github.com/leeyun-amzn/alerting…
Sep 7, 2021
bf6cbb4
Merge remote-tracking branch 'upstream/main' into jest-update
Sep 7, 2021
5f5ca10
Update snapshots
Sep 7, 2021
b5eb796
Merge branch 'main' of https://github.com/leeyun-amzn/alerting-dashbo…
Sep 8, 2021
94e3301
Merge remote-tracking branch 'upstream/main' into main
Sep 8, 2021
045cdd6
Merge branch 'main' into jest-update
Sep 8, 2021
db113f3
Merge remote-tracking branch 'upstream/main' into main
Sep 8, 2021
d16b472
Merge branch 'main' into jest-update
Sep 8, 2021
2c2aa0f
Merge branch 'main' into jest-update
Sep 8, 2021
2556cd6
Update formikToTrigger.test.js
Sep 8, 2021
4d9008a
Update formikToTrigger.test.js
Sep 8, 2021
59d3a78
Update formikToTrigger.test.js
Sep 8, 2021
382db32
Merge branch 'jest-update' of https://github.com/leeyun-amzn/alerting…
Sep 8, 2021
559b479
Add icon tooltip
Sep 9, 2021
f71c2aa
Add test
Sep 9, 2021
6137ff0
Merge branch 'text-update' into jest-update
Sep 9, 2021
bce1d48
Update tests
Sep 9, 2021
23b48e9
remove license
Sep 10, 2021
f304f3e
Update TriggerExpressions.test.js
Sep 10, 2021
dd9dc51
Update Triggers.test.js
Sep 10, 2021
850d8ca
Merge remote-tracking branch 'upstream/main' into main
Sep 10, 2021
86f170f
Merge branch 'main' into jest-update
Sep 10, 2021
a2430c6
Update validation test
Sep 10, 2021
eb980f8
Update getOverviewStats.test.js
Sep 10, 2021
f56e3bf
Update validate.test.js
Sep 10, 2021
73937c6
Update helpers.test.js and remove unused import
Sep 10, 2021
1990ed3
Update Triggers.test.js
Sep 10, 2021
4f0d19a
Update helpers.js
Sep 14, 2021
78e2247
Update CreateMonitor test and clean up code
Sep 14, 2021
b46bac1
Update CreateMonitor test and clean up code
Sep 14, 2021
d054d05
Merge branch 'jest-update' of https://github.com/leeyun-amzn/alerting…
Sep 14, 2021
ddc6fad
Update release note and adding more tests
Sep 14, 2021
f2e4dd9
Add test and modify cypress common-utils branch
Sep 14, 2021
4d5ee29
Update MonitorDefinitionCard.test.js.snap
Sep 14, 2021
f0e3543
Update cypress-workflow.yml
Sep 14, 2021
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
4 changes: 2 additions & 2 deletions .github/workflows/cypress-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
with:
repository: opensearch-project/OpenSearch
path: OpenSearch
ref: '1.x'
ref: '1.1'
- name: Build OpenSearch
working-directory: ./OpenSearch
run: ./gradlew publishToMavenLocal
Expand All @@ -40,7 +40,7 @@ jobs:
with:
repository: opensearch-project/common-utils
path: common-utils
ref: 'main'
ref: '1.1'
- name: Build common-utils
working-directory: ./common-utils
run: ./gradlew publishToMavenLocal -Dopensearch.version=${{ env.OPENSEARCH_VERSION }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Object {
exports[`getBreadcrumb returns correct constant breadcrumbs 3`] = `
Object {
"href": "/dashboard",
"text": "Dashboard",
"text": "Alerts",
}
`;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@ exports[`ContentPanel renders 1`] = `
</div>
</div>
</div>
<div
class="euiText euiText--extraSmall"
style="padding:0px 10px"
>
<div
class="euiTextColor euiTextColor--subdued"
/>
</div>
<hr
class="euiHorizontalRule euiHorizontalRule--full euiHorizontalRule--marginXSmall"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ exports[`Flyout renders 1`] = `
<ul>
<li>
<EuiLink
external={true}
href="https://mustache.github.io/mustache.5.html"
target="_blank"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Object {
<ul>
<li>
<EuiLink
external={true}
href="https://mustache.github.io/mustache.5.html"
target="_blank"
>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*
* Modifications Copyright OpenSearch Contributors. See
* GitHub history for details.
*/

import React from 'react';
import { render } from 'enzyme';
import { Formik } from 'formik';

import FormikCheckableCard from './FormikCheckableCard';

describe('FormikCheckableCard', () => {
test('render formRow', () => {
const component = (
<Formik>
<FormikCheckableCard name="testing" formRow />
</Formik>
);

expect(render(component)).toMatchSnapshot();
});

test('render', () => {
const component = (
<Formik>
<FormikCheckableCard name="testing" />
</Formik>
);

expect(render(component)).toMatchSnapshot();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`FormikCheckableCard render 1`] = `
<div
class="euiCheckableCard"
>
<div
class="euiCheckableCard__row"
>
<div
class="euiCheckableCard__control"
>
<div
class="euiRadio euiRadio--noLabel"
>
<input
class="euiRadio__input"
name="testing"
type="radio"
/>
<div
class="euiRadio__circle"
/>
</div>
</div>
<label
class="euiCheckableCard__label"
/>
</div>
</div>
`;

exports[`FormikCheckableCard render formRow 1`] = `
<div
class="euiFormRow"
id="testing-form-row-row"
>
<div
class="euiFormRow__fieldWrapper"
>
<div
class="euiCheckableCard"
>
<div
class="euiCheckableCard__row"
>
<div
class="euiCheckableCard__control"
>
<div
class="euiRadio euiRadio--noLabel"
>
<input
class="euiRadio__input"
name="testing"
type="radio"
/>
<div
class="euiRadio__circle"
/>
</div>
</div>
<label
class="euiCheckableCard__label"
/>
</div>
</div>
</div>
</div>
`;
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,20 @@ import { render } from 'enzyme';
import { Formik } from 'formik';

import FormikCodeEditor from './FormikCodeEditor';
import FormikCheckableCard from '../FormikCheckableCard';

// FIXME: This has an issue where EuiCodeEditor is generating a random HTML id and failing snapshot test

describe.skip('FormikCodeEditor', () => {
describe('FormikCodeEditor', () => {
test('render formRow', () => {
const component = (
<Formik>
<FormikCodeEditor name="testing" formRow />
</Formik>
);

expect(render(component)).toMatchSnapshot();
});
test('renders', () => {
const component = (
<Formik>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`FormikCodeEditor render formRow 1`] = `
<div
class="euiFormRow"
id="testing-form-row-row"
>
<div
class="euiFormRow__fieldWrapper"
>
<div
class="euiCodeEditorWrapper"
data-test-subj="codeEditorContainer"
>
<div
class="euiCodeEditorKeyboardHint"
data-test-subj="codeEditorHint"
id="generated-id"
role="button"
tabindex="0"
>
<p
class="euiText"
>
Press Enter to start editing.
</p>
<p
class="euiText"
>
When you're done, press Escape to stop editing.
</p>
</div>
<div
id="generated-id"
style="width:500px;height:500px"
/>
</div>
</div>
</div>
`;

exports[`FormikCodeEditor renders 1`] = `
<div
class="euiCodeEditorWrapper"
data-test-subj="codeEditorContainer"
>
<div
class="euiCodeEditorKeyboardHint"
data-test-subj="codeEditorHint"
id="generated-id"
role="button"
tabindex="0"
>
<p
class="euiText"
>
Press Enter to start editing.
</p>
<p
class="euiText"
>
When you're done, press Escape to stop editing.
</p>
</div>
<div
id="generated-id"
style="width:500px;height:500px"
/>
</div>
`;
22 changes: 22 additions & 0 deletions public/components/IconToolTip/IconToolTip.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*
* Modifications Copyright OpenSearch Contributors. See
* GitHub history for details.
*/

import React from 'react';
import { render } from 'enzyme';

import IconToolTip from './IconToolTip';

describe('IconToolTip', () => {
test('renders', () => {
const component = <IconToolTip iconType="questionInCircle" content="test content" />;
expect(render(component)).toMatchSnapshot();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`IconToolTip renders 1`] = `
<span
class="euiToolTipAnchor"
>
<div>
EuiIconMock
</div>
</span>
`;
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*
* Modifications Copyright OpenSearch Contributors. See
* GitHub history for details.
*/

import React from 'react';
import { mount, render } from 'enzyme';
import { FeatureChart } from './FeatureChart';
import AlertingFakes from '../../../../../../test/utils/helpers';

const alertingFakes = new AlertingFakes('random seed');

function getMountWrapper(customProps = {}) {
return mount(
<FeatureChart
startDateTime={alertingFakes.randomTime()}
endDateTime={alertingFakes.randomTime()}
featureData={[]}
isLoading={false}
title="Test"
/>
);
}

describe('FeatureChart', () => {
test('renders ', () => {
const component = (
<FeatureChart
startDateTime={alertingFakes.randomTime()}
endDateTime={alertingFakes.randomTime()}
featureData={[]}
isLoading={false}
title="Test"
/>
);
expect(render(component)).toMatchSnapshot();
});

test('go to page ', () => {
const mountWrapper = getMountWrapper();
mountWrapper.instance().goToPage(1);
expect(mountWrapper.instance().state.activePage).toBe(1);
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`FeatureChart renders 1`] = `null`;
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,16 @@ import React from 'react';
import { render } from 'enzyme';

import ExtractionQuery from './ExtractionQuery';
import { Formik } from 'formik';
import { FORMIK_INITIAL_VALUES } from '../../containers/CreateMonitor/utils/constants';

describe.skip('ExtractionQuery', () => {
describe('ExtractionQuery', () => {
test('renders', () => {
const component = <ExtractionQuery response={JSON.stringify({ hits: 10 })} />;
const component = (
<Formik initialValues={FORMIK_INITIAL_VALUES}>
{() => <ExtractionQuery response={JSON.stringify({ hits: 10 })} />}
</Formik>
);

expect(render(component)).toMatchSnapshot();
});
Expand Down
Loading