From 3a874ba9bf6a1990172727b85f0f391a501521bb Mon Sep 17 00:00:00 2001 From: Matt Kime Date: Thu, 7 Apr 2022 23:59:20 -0500 Subject: [PATCH] minor fixes --- .../client_integration/field_editor.test.tsx | 3 +-- .../field_editor_flyout_preview.test.ts | 12 +++--------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/src/plugins/data_view_field_editor/__jest__/client_integration/field_editor.test.tsx b/src/plugins/data_view_field_editor/__jest__/client_integration/field_editor.test.tsx index 55b9876ac54ad..1ba108492e7f9 100644 --- a/src/plugins/data_view_field_editor/__jest__/client_integration/field_editor.test.tsx +++ b/src/plugins/data_view_field_editor/__jest__/client_integration/field_editor.test.tsx @@ -19,7 +19,7 @@ import { } from './field_editor.helpers'; describe('', () => { - const { server, httpRequestsMockHelpers } = setupEnvironment(); + const { httpRequestsMockHelpers } = setupEnvironment(); let testBed: FieldEditorTestBed; let onChange: jest.Mock = jest.fn(); @@ -70,7 +70,6 @@ describe('', () => { afterAll(() => { jest.useRealTimers(); - server.restore(); }); beforeEach(async () => { diff --git a/src/plugins/data_view_field_editor/__jest__/client_integration/field_editor_flyout_preview.test.ts b/src/plugins/data_view_field_editor/__jest__/client_integration/field_editor_flyout_preview.test.ts index 25c4e23e25326..c967015cfaceb 100644 --- a/src/plugins/data_view_field_editor/__jest__/client_integration/field_editor_flyout_preview.test.ts +++ b/src/plugins/data_view_field_editor/__jest__/client_integration/field_editor_flyout_preview.test.ts @@ -59,7 +59,6 @@ describe('Field editor Preview panel', () => { setSearchResponse(mockDocuments); setSearchResponseLatency(0); - // testBed = await setup(undefined, { server }); testBed = await setup(); }); @@ -275,13 +274,7 @@ describe('Field editor Preview panel', () => { httpRequestsMockHelpers.setFieldPreviewResponse({ values: [scriptEmitResponse] }); const { - actions: { - toggleFormRow, - fields, - waitForUpdates, - // getLatestPreviewHttpRequest, - getRenderedFieldsPreview, - }, + actions: { toggleFormRow, fields, waitForUpdates, getRenderedFieldsPreview }, } = testBed; await toggleFormRow('value'); @@ -290,7 +283,8 @@ describe('Field editor Preview panel', () => { await waitForUpdates(); // Run validations // Make sure the payload sent is correct - const payload = JSON.parse(server.post.mock.calls[0][1]?.body); + const firstCall = server.post.mock.calls[0] as Array<{ body: any }>; + const payload = JSON.parse(firstCall[1]?.body); expect(payload).toEqual({ context: 'keyword_field', document: {