forked from opensearch-project/alerting-dashboards-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update jest unit tests (opensearch-project#112)
* Update .opensearch_dashboards-plugin-helpers.json * Update snapshots * Update whereExpression.test and some snapshots * Update whereExpression.test and some snapshots Signed-off-by: Annie Lee <leeyun@amazon.com> * Update snapshots * Update formikToTrigger.test.js * Update formikToTrigger.test.js * Update formikToTrigger.test.js * Add icon tooltip * Add test * Update tests * remove license * Update TriggerExpressions.test.js * Update Triggers.test.js * Update validation test * Update getOverviewStats.test.js * Update validate.test.js * Update helpers.test.js and remove unused import * Update Triggers.test.js * Update helpers.js * Update CreateMonitor test and clean up code * Update CreateMonitor test and clean up code Signed-off-by: Annie Lee <leeyun@amazon.com> * Update release note and adding more tests * Add test and modify cypress common-utils branch * Update MonitorDefinitionCard.test.js.snap * Update cypress-workflow.yml Signed-off-by: Annie Lee <leeyun@amazon.com>
- Loading branch information
Showing
60 changed files
with
2,779 additions
and
990 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
public/components/FormControls/FormikCheckableCard/FormikCheckableCard.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
}); | ||
}); |
70 changes: 70 additions & 0 deletions
70
...omponents/FormControls/FormikCheckableCard/__snapshots__/FormikCheckableCard.test.js.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
public/components/FormControls/FormikCodeEditor/__snapshots__/FormikCodeEditor.test.js.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
}); | ||
}); |
11 changes: 11 additions & 0 deletions
11
public/components/IconToolTip/__snapshots__/IconToolTip.test.js.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
`; |
50 changes: 50 additions & 0 deletions
50
public/pages/CreateMonitor/components/AnomalyDetectors/FeatureChart/FeatureChart.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
}); | ||
}); |
3 changes: 3 additions & 0 deletions
3
...eMonitor/components/AnomalyDetectors/FeatureChart/__snapshots__/FeatureChart.test.js.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.