diff --git a/public/models/Detectors/components/DetectorRulesView/DetectorRulesViewMock.test.ts b/public/models/Detectors/components/DetectorRulesView/DetectorRulesViewMock.test.ts index 7cd0ed1e0..d0688d7ec 100644 --- a/public/models/Detectors/components/DetectorRulesView/DetectorRulesViewMock.test.ts +++ b/public/models/Detectors/components/DetectorRulesView/DetectorRulesViewMock.test.ts @@ -1,6 +1,8 @@ import { detectorMock } from '../../InterfacesMock.test'; -const notificationsStart: NotificationsStart = {}; +const notificationsStart = { + toasts: [], +}; export default { detector: detectorMock, rulesCanFold: true, diff --git a/public/models/Detectors/components/FieldMappingsView/FieldMappingsViewMock.test.ts b/public/models/Detectors/components/FieldMappingsView/FieldMappingsViewMock.test.ts new file mode 100644 index 000000000..294df7d1f --- /dev/null +++ b/public/models/Detectors/components/FieldMappingsView/FieldMappingsViewMock.test.ts @@ -0,0 +1,16 @@ +import { FieldMapping } from '../../../../../models/interfaces'; +import { detectorMock } from '../../InterfacesMock.test'; +const notificationsStart = { + toasts: [], +}; + +const fieldMapping: FieldMapping = { + indexFieldName: 'indexFieldName', + ruleFieldName: 'ruleFieldName', +}; +export default { + detector: detectorMock, + existingMappings: [fieldMapping, fieldMapping], + editFieldMappings: jest.fn(), + notifications: notificationsStart, +}; diff --git a/public/pages/Detectors/components/FieldMappingsView/FieldMappingsView.test.tsx b/public/pages/Detectors/components/FieldMappingsView/FieldMappingsView.test.tsx new file mode 100644 index 000000000..a66339994 --- /dev/null +++ b/public/pages/Detectors/components/FieldMappingsView/FieldMappingsView.test.tsx @@ -0,0 +1,17 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +import React from 'react'; +import { render } from '@testing-library/react'; +import props from '../../../../models/Detectors/components/FieldMappingsView/FieldMappingsViewMock.test'; +import { expect } from '@jest/globals'; +import { FieldMappingsView } from './FieldMappingsView'; + +describe(' spec', () => { + it('renders the component', () => { + const view = render(); + expect(view).toMatchSnapshot(); + }); +}); diff --git a/public/pages/Detectors/components/FieldMappingsView/__snapshots__/FieldMappingsView.test.tsx.snap b/public/pages/Detectors/components/FieldMappingsView/__snapshots__/FieldMappingsView.test.tsx.snap new file mode 100644 index 000000000..9c356e54c --- /dev/null +++ b/public/pages/Detectors/components/FieldMappingsView/__snapshots__/FieldMappingsView.test.tsx.snap @@ -0,0 +1,468 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[` spec renders the component 1`] = ` +Object { + "asFragment": [Function], + "baseElement": +
+
+
+
+

+ Field mapping +

+
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + +
+
+ + + Rule field name + + + + + + Mapped index field name + + +
+
+ Rule field name +
+
+ + ruleFieldName + +
+
+
+ Mapped index field name +
+
+ + indexFieldName + +
+
+
+ Rule field name +
+
+ + ruleFieldName + +
+
+
+ Mapped index field name +
+
+ + indexFieldName + +
+
+
+
+
+
+
+ , + "container":
+
+
+
+

+ Field mapping +

+
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + +
+
+ + + Rule field name + + + + + + Mapped index field name + + +
+
+ Rule field name +
+
+ + ruleFieldName + +
+
+
+ Mapped index field name +
+
+ + indexFieldName + +
+
+
+ Rule field name +
+
+ + ruleFieldName + +
+
+
+ Mapped index field name +
+
+ + indexFieldName + +
+
+
+
+
+
+
, + "debug": [Function], + "findAllByAltText": [Function], + "findAllByDisplayValue": [Function], + "findAllByLabelText": [Function], + "findAllByPlaceholderText": [Function], + "findAllByRole": [Function], + "findAllByTestId": [Function], + "findAllByText": [Function], + "findAllByTitle": [Function], + "findByAltText": [Function], + "findByDisplayValue": [Function], + "findByLabelText": [Function], + "findByPlaceholderText": [Function], + "findByRole": [Function], + "findByTestId": [Function], + "findByText": [Function], + "findByTitle": [Function], + "getAllByAltText": [Function], + "getAllByDisplayValue": [Function], + "getAllByLabelText": [Function], + "getAllByPlaceholderText": [Function], + "getAllByRole": [Function], + "getAllByTestId": [Function], + "getAllByText": [Function], + "getAllByTitle": [Function], + "getByAltText": [Function], + "getByDisplayValue": [Function], + "getByLabelText": [Function], + "getByPlaceholderText": [Function], + "getByRole": [Function], + "getByTestId": [Function], + "getByText": [Function], + "getByTitle": [Function], + "queryAllByAltText": [Function], + "queryAllByDisplayValue": [Function], + "queryAllByLabelText": [Function], + "queryAllByPlaceholderText": [Function], + "queryAllByRole": [Function], + "queryAllByTestId": [Function], + "queryAllByText": [Function], + "queryAllByTitle": [Function], + "queryByAltText": [Function], + "queryByDisplayValue": [Function], + "queryByLabelText": [Function], + "queryByPlaceholderText": [Function], + "queryByRole": [Function], + "queryByTestId": [Function], + "queryByText": [Function], + "queryByTitle": [Function], + "rerender": [Function], + "unmount": [Function], +} +`;