diff --git a/x-pack/plugins/index_management/public/application/components/mappings_editor/__jest__/client_integration/datatypes/text_datatype.test.tsx b/x-pack/plugins/index_management/public/application/components/mappings_editor/__jest__/client_integration/datatypes/text_datatype.test.tsx index 4386f584b5d490..2bfaa884a01329 100644 --- a/x-pack/plugins/index_management/public/application/components/mappings_editor/__jest__/client_integration/datatypes/text_datatype.test.tsx +++ b/x-pack/plugins/index_management/public/application/components/mappings_editor/__jest__/client_integration/datatypes/text_datatype.test.tsx @@ -105,16 +105,6 @@ describe('Mappings editor: text datatype', () => { }, }; - let updatedMappings: any = { - ...defaultMappings, - properties: { - myField: { - ...defaultMappings.properties.myField, - ...defaultTextParameters, - }, - }, - }; - testBed = await setup({ value: defaultMappings, onChange: onChangeHandler }); const { @@ -150,6 +140,15 @@ describe('Mappings editor: text datatype', () => { ({ data } = await getMappingsEditorData()); + let updatedMappings: any = { + ...defaultMappings, + properties: { + myField: { + ...defaultMappings.properties.myField, + ...defaultTextParameters, + }, + }, + }; expect(data).toEqual(updatedMappings); // Re-open the edit panel diff --git a/x-pack/plugins/index_management/public/application/components/mappings_editor/__jest__/client_integration/mappings_editor.test.tsx b/x-pack/plugins/index_management/public/application/components/mappings_editor/__jest__/client_integration/mappings_editor.test.tsx index e26dbf6f56ce3a..f516dfdb372ce7 100644 --- a/x-pack/plugins/index_management/public/application/components/mappings_editor/__jest__/client_integration/mappings_editor.test.tsx +++ b/x-pack/plugins/index_management/public/application/components/mappings_editor/__jest__/client_integration/mappings_editor.test.tsx @@ -5,7 +5,7 @@ */ import { act } from 'react-dom/test-utils'; -import { componentHelpers, MappingsEditorTestBed, nextTick, getRandomString } from './helpers'; +import { componentHelpers, MappingsEditorTestBed, nextTick } from './helpers'; const { setup, getMappingsEditorDataFactory } = componentHelpers.mappingsEditor; const onChangeHandler = jest.fn(); @@ -322,7 +322,7 @@ describe('Mappings editor: core', () => { /** * Mapped fields */ - const newField = { name: getRandomString(), type: 'text' }; + const newField = { name: 'someNewField', type: 'text' }; updatedMappings = { ...updatedMappings, properties: { diff --git a/x-pack/plugins/index_management/public/application/components/mappings_editor/lib/utils.test.ts b/x-pack/plugins/index_management/public/application/components/mappings_editor/lib/utils.test.ts index 4a1d3254ad7af8..4b610ff0b401df 100644 --- a/x-pack/plugins/index_management/public/application/components/mappings_editor/lib/utils.test.ts +++ b/x-pack/plugins/index_management/public/application/components/mappings_editor/lib/utils.test.ts @@ -74,6 +74,8 @@ describe('utils', () => { someArray: [1, 2, 3], someEmptyObject: {}, someDate: myDate, + falsey1: 0, + falsey2: '', stripThis: undefined, nested: { value: 'bar', @@ -92,6 +94,8 @@ describe('utils', () => { someArray: [1, 2, 3], someEmptyObject: {}, someDate: myDate, + falsey1: 0, + falsey2: '', nested: { value: 'bar', deepNested: {