diff --git a/x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/__snapshots__/closure_options.test.tsx.snap b/x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/__snapshots__/closure_options.test.tsx.snap
deleted file mode 100644
index 2f5d1e8198716..0000000000000
--- a/x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/__snapshots__/closure_options.test.tsx.snap
+++ /dev/null
@@ -1,32 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`ClosureOptions it renders 1`] = `
-
- Cases Closures
-
- }
->
-
-
-
-
-`;
diff --git a/x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/__snapshots__/closure_options_radio.test.tsx.snap b/x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/__snapshots__/closure_options_radio.test.tsx.snap
deleted file mode 100644
index 8a9dd84654dcc..0000000000000
--- a/x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/__snapshots__/closure_options_radio.test.tsx.snap
+++ /dev/null
@@ -1,23 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`ClosureOptionsRadio it renders 1`] = `
-
-`;
diff --git a/x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/__snapshots__/connectors.test.tsx.snap b/x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/__snapshots__/connectors.test.tsx.snap
deleted file mode 100644
index 8bbe85cb7d197..0000000000000
--- a/x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/__snapshots__/connectors.test.tsx.snap
+++ /dev/null
@@ -1,52 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`Connectors it renders 1`] = `
-
-
- Connect to third-party incident management system
-
- }
- >
-
-
- Incident management system
-
-
-
- Add new connector option
-
-
-
- }
- >
-
-
-
-
-`;
diff --git a/x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/__snapshots__/connectors_dropdown.test.tsx.snap b/x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/__snapshots__/connectors_dropdown.test.tsx.snap
deleted file mode 100644
index 414ea785ee207..0000000000000
--- a/x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/__snapshots__/connectors_dropdown.test.tsx.snap
+++ /dev/null
@@ -1,32 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`ConnectorsDropdown it renders 1`] = `
-
-
-
- No connector selected
-
- ,
- "value": "none",
- },
- ]
- }
- valueOfSelected="none"
-/>
-`;
diff --git a/x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/__snapshots__/field_mapping.test.tsx.snap b/x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/__snapshots__/field_mapping.test.tsx.snap
deleted file mode 100644
index 118433d4e39d4..0000000000000
--- a/x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/__snapshots__/field_mapping.test.tsx.snap
+++ /dev/null
@@ -1,325 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`FieldMappingRow it renders 1`] = `
-
-
-
-
-
- SIEM case field
-
-
-
-
- External incident field
-
-
-
-
- On edit and update
-
-
-
-
-
-
- Not mapped
- ,
- "value": "not_mapped",
- },
- Object {
- "data-test-subj": "third-party-field-short-description",
- "inputDisplay":
- Short Description
- ,
- "value": "short_description",
- },
- Object {
- "data-test-subj": "third-party-field-comments",
- "inputDisplay":
- Comments
- ,
- "value": "comments",
- },
- Object {
- "data-test-subj": "third-party-field-description",
- "inputDisplay":
- Description
- ,
- "value": "description",
- },
- ]
- }
- />
-
- Not mapped
- ,
- "value": "not_mapped",
- },
- Object {
- "data-test-subj": "third-party-field-short-description",
- "inputDisplay":
- Short Description
- ,
- "value": "short_description",
- },
- Object {
- "data-test-subj": "third-party-field-comments",
- "inputDisplay":
- Comments
- ,
- "value": "comments",
- },
- Object {
- "data-test-subj": "third-party-field-description",
- "inputDisplay":
- Description
- ,
- "value": "description",
- },
- ]
- }
- />
-
- Not mapped
- ,
- "value": "not_mapped",
- },
- Object {
- "data-test-subj": "third-party-field-short-description",
- "inputDisplay":
- Short Description
- ,
- "value": "short_description",
- },
- Object {
- "data-test-subj": "third-party-field-comments",
- "inputDisplay":
- Comments
- ,
- "value": "comments",
- },
- Object {
- "data-test-subj": "third-party-field-description",
- "inputDisplay":
- Description
- ,
- "value": "description",
- },
- ]
- }
- />
-
-
-`;
-
-exports[`FieldMappingRow it renders with default mapping 1`] = `
-
-
-
-
-
- SIEM case field
-
-
-
-
- External incident field
-
-
-
-
- On edit and update
-
-
-
-
-
-
- Not mapped
- ,
- "value": "not_mapped",
- },
- Object {
- "data-test-subj": "third-party-field-short-description",
- "inputDisplay":
- Short Description
- ,
- "value": "short_description",
- },
- Object {
- "data-test-subj": "third-party-field-comments",
- "inputDisplay":
- Comments
- ,
- "value": "comments",
- },
- Object {
- "data-test-subj": "third-party-field-description",
- "inputDisplay":
- Description
- ,
- "value": "description",
- },
- ]
- }
- />
-
- Not mapped
- ,
- "value": "not_mapped",
- },
- Object {
- "data-test-subj": "third-party-field-short-description",
- "inputDisplay":
- Short Description
- ,
- "value": "short_description",
- },
- Object {
- "data-test-subj": "third-party-field-comments",
- "inputDisplay":
- Comments
- ,
- "value": "comments",
- },
- Object {
- "data-test-subj": "third-party-field-description",
- "inputDisplay":
- Description
- ,
- "value": "description",
- },
- ]
- }
- />
-
- Not mapped
- ,
- "value": "not_mapped",
- },
- Object {
- "data-test-subj": "third-party-field-short-description",
- "inputDisplay":
- Short Description
- ,
- "value": "short_description",
- },
- Object {
- "data-test-subj": "third-party-field-comments",
- "inputDisplay":
- Comments
- ,
- "value": "comments",
- },
- Object {
- "data-test-subj": "third-party-field-description",
- "inputDisplay":
- Description
- ,
- "value": "description",
- },
- ]
- }
- />
-
-
-`;
diff --git a/x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/__snapshots__/field_mapping_row.test.tsx.snap b/x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/__snapshots__/field_mapping_row.test.tsx.snap
deleted file mode 100644
index aeda3bc2228d2..0000000000000
--- a/x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/__snapshots__/field_mapping_row.test.tsx.snap
+++ /dev/null
@@ -1,98 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`FieldMappingRow it renders 1`] = `
-
-
-
-
- Title
-
-
-
-
-
-
-
-
- Short Description
- ,
- "value": "short_description",
- },
- Object {
- "data-test-subj": "third-party-desc",
- "inputDisplay":
- Description
- ,
- "value": "description",
- },
- ]
- }
- valueOfSelected="short_description"
- />
-
-
-
- Nothing
- ,
- "value": "nothing",
- },
- Object {
- "data-test-subj": "edit-update-option-overwrite",
- "inputDisplay":
- Overwrite
- ,
- "value": "overwrite",
- },
- Object {
- "data-test-subj": "edit-update-option-append",
- "inputDisplay":
- Append
- ,
- "value": "append",
- },
- ]
- }
- valueOfSelected="nothing"
- />
-
-
-`;
diff --git a/x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/__snapshots__/index.test.tsx.snap b/x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/__snapshots__/index.test.tsx.snap
deleted file mode 100644
index f79590d9ea801..0000000000000
--- a/x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/__snapshots__/index.test.tsx.snap
+++ /dev/null
@@ -1,158 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`ConfigureCases it renders 1`] = `
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-`;
diff --git a/x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/__snapshots__/mapping.test.tsx.snap b/x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/__snapshots__/mapping.test.tsx.snap
deleted file mode 100644
index 624f330953e6a..0000000000000
--- a/x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/__snapshots__/mapping.test.tsx.snap
+++ /dev/null
@@ -1,65 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`Mapping it renders 1`] = `
-
- Field mappings
-
- }
->
-
-
-
-
- Update connector
-
-
-
-
-
-
-`;
diff --git a/x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/closure_options.test.tsx b/x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/closure_options.test.tsx
index 46cd3dea7f2e7..4088c5016a5d8 100644
--- a/x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/closure_options.test.tsx
+++ b/x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/closure_options.test.tsx
@@ -15,7 +15,7 @@ import { ClosureOptionsRadio } from './closure_options_radio';
describe('ClosureOptions', () => {
const mount = useMountAppended();
- test('it renders', () => {
+ test('it shows the left side', () => {
const wrapper = shallow(
{
/>
);
- expect(wrapper).toMatchSnapshot();
- });
-
- test('it shows the left side', () => {
- const wrapper = mount(
- ,
- { wrappingComponent: TestProviders }
- );
-
expect(
wrapper
.find('[data-test-subj="case-closure-options-form-group"]')
diff --git a/x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/closure_options_radio.test.tsx b/x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/closure_options_radio.test.tsx
index 85352ec6b3682..6d654d242542f 100644
--- a/x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/closure_options_radio.test.tsx
+++ b/x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/closure_options_radio.test.tsx
@@ -23,7 +23,12 @@ describe('ClosureOptionsRadio', () => {
/>
);
- expect(wrapper).toMatchSnapshot();
+ expect(
+ wrapper
+ .find('[data-test-subj="closure-options-radio-group"]')
+ .first()
+ .exists()
+ ).toBe(true);
});
test('it shows the correct number of radio buttons', () => {
diff --git a/x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/connectors.test.tsx b/x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/connectors.test.tsx
index c60722929343c..371c7cb172e70 100644
--- a/x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/connectors.test.tsx
+++ b/x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/connectors.test.tsx
@@ -16,7 +16,7 @@ import { connectors } from './__mock__';
describe('Connectors', () => {
const mount = useMountAppended();
- test('it renders', () => {
+ test('it shows the left side', () => {
const wrapper = shallow(
{
/>
);
- expect(wrapper).toMatchSnapshot();
- });
-
- test('it shows the left side', () => {
- const wrapper = mount(
- ,
- { wrappingComponent: TestProviders }
- );
-
expect(
wrapper
.find('[data-test-subj="case-connectors-form-group"]')
diff --git a/x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/connectors_dropdown.test.tsx b/x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/connectors_dropdown.test.tsx
index 6cc7ff0aec41f..59a8d80b040ea 100644
--- a/x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/connectors_dropdown.test.tsx
+++ b/x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/connectors_dropdown.test.tsx
@@ -27,7 +27,12 @@ describe('ConnectorsDropdown', () => {
/>
);
- expect(wrapper).toMatchSnapshot();
+ expect(
+ wrapper
+ .find('[data-test-subj="dropdown-connectors"]')
+ .first()
+ .exists()
+ ).toBe(true);
});
test('it formats the connectors correctly', () => {
diff --git a/x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/field_mapping.test.tsx b/x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/field_mapping.test.tsx
index 30f392ff7e8df..64bd6a57f17e1 100644
--- a/x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/field_mapping.test.tsx
+++ b/x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/field_mapping.test.tsx
@@ -10,6 +10,7 @@ import { shallow } from 'enzyme';
import { FieldMapping } from './field_mapping';
import { mapping } from './__mock__';
import { FieldMappingRow } from './field_mapping_row';
+import { defaultMapping } from '../../../../lib/connectors/config';
describe('FieldMappingRow', () => {
test('it renders', () => {
@@ -17,21 +18,19 @@ describe('FieldMappingRow', () => {
);
- expect(wrapper).toMatchSnapshot();
- });
-
- test('it renders with default mapping', () => {
- const wrapper = shallow(
-
- );
+ expect(
+ wrapper
+ .find('[data-test-subj="case-configure-field-mapping-cols"]')
+ .first()
+ .exists()
+ ).toBe(true);
- expect(wrapper).toMatchSnapshot();
- });
-
- test('it shows the correct number of FieldMappingRow', () => {
- const wrapper = shallow(
-
- );
+ expect(
+ wrapper
+ .find('[data-test-subj="case-configure-field-mapping-row-wrapper"]')
+ .first()
+ .exists()
+ ).toBe(true);
expect(wrapper.find(FieldMappingRow).length).toEqual(3);
});
@@ -57,6 +56,19 @@ describe('FieldMappingRow', () => {
});
});
+ test('it pass the default mapping when mapping is null', () => {
+ const wrapper = shallow(
+
+ );
+
+ const rows = wrapper.find(FieldMappingRow);
+ rows.forEach((row, index) => {
+ expect(row.prop('siemField')).toEqual(defaultMapping[index].source);
+ expect(row.prop('selectedActionType')).toEqual(defaultMapping[index].actionType);
+ expect(row.prop('selectedThirdParty')).toEqual(defaultMapping[index].target);
+ });
+ });
+
test('it should show zero rows on empty array', () => {
const wrapper = shallow(
diff --git a/x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/field_mapping.tsx b/x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/field_mapping.tsx
index 0cf43a16b810a..e22c31943afc0 100644
--- a/x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/field_mapping.tsx
+++ b/x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/field_mapping.tsx
@@ -76,7 +76,7 @@ const FieldMappingComponent: React.FC = ({
);
return (
<>
-
+
{i18n.FIELD_MAPPING_FIRST_COL}
@@ -89,7 +89,7 @@ const FieldMappingComponent: React.FC = ({
-
+
{(mapping ?? defaultMapping).map(item => (
{
/>
);
- expect(wrapper).toMatchSnapshot();
+ expect(
+ wrapper
+ .find('[data-test-subj="case-configure-third-party-select"]')
+ .first()
+ .exists()
+ ).toBe(true);
+
+ expect(
+ wrapper
+ .find('[data-test-subj="case-configure-action-type-select"]')
+ .first()
+ .exists()
+ ).toBe(true);
});
test('it passes thirdPartyOptions correctly', () => {
diff --git a/x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/index.test.tsx b/x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/index.test.tsx
index d50665886616f..139833b961ff3 100644
--- a/x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/index.test.tsx
+++ b/x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/index.test.tsx
@@ -5,7 +5,6 @@
*/
import React, { useEffect } from 'react';
-import { shallow } from 'enzyme';
import { useKibana } from '../../../../lib/kibana';
import {
@@ -76,12 +75,6 @@ describe('ConfigureCases', () => {
useGetUrlSearchMock.mockImplementation(() => searchURL);
});
- test('it renders', () => {
- const wrapper = shallow(, { wrappingComponent: TestProviders });
-
- expect(wrapper).toMatchSnapshot();
- });
-
test('it renders correctly', () => {
useCaseConfigureMock.mockImplementation(
({ setConnector, setClosureType, setCurrentConfiguration }) => {
diff --git a/x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/mapping.test.tsx b/x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/mapping.test.tsx
index b4e2f0ba9d8bb..f9b8941f52ad0 100644
--- a/x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/mapping.test.tsx
+++ b/x-pack/legacy/plugins/siem/public/pages/case/components/configure_cases/mapping.test.tsx
@@ -15,7 +15,7 @@ import { mapping } from './__mock__';
describe('Mapping', () => {
const mount = useMountAppended();
- test('it renders', () => {
+ test('it shows the left side', () => {
const wrapper = shallow(
{
/>
);
- expect(wrapper).toMatchSnapshot();
- });
-
- test('it shows the left side', () => {
- const wrapper = mount(
- ,
- { wrappingComponent: TestProviders }
- );
-
expect(
wrapper
.find('[data-test-subj="case-mapping-form-group"]')