From 9f1cce2544e3f7f025b877bbc22c1ec159d03f1d Mon Sep 17 00:00:00 2001 From: Bishoy Boktor Date: Thu, 31 Mar 2022 02:40:05 +0000 Subject: [PATCH] Fixes 2 failing unit tests Signed-off-by: Bishoy Boktor --- src/core/server/opensearch/opensearch_config.test.mocks.ts | 3 ++- .../embeddable/viewport/dashboard_viewport.test.tsx | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/core/server/opensearch/opensearch_config.test.mocks.ts b/src/core/server/opensearch/opensearch_config.test.mocks.ts index 7e3e346afa1d..9fb0c050177c 100644 --- a/src/core/server/opensearch/opensearch_config.test.mocks.ts +++ b/src/core/server/opensearch/opensearch_config.test.mocks.ts @@ -29,7 +29,8 @@ */ export const mockReadFileSync = jest.fn(); -jest.mock('fs', () => ({ readFileSync: mockReadFileSync })); +export const mockRead = jest.fn(); +jest.mock('fs', () => ({ readFileSync: mockReadFileSync, read: mockRead })); export const mockReadPkcs12Keystore = jest.fn(); export const mockReadPkcs12Truststore = jest.fn(); diff --git a/src/plugins/dashboard/public/application/embeddable/viewport/dashboard_viewport.test.tsx b/src/plugins/dashboard/public/application/embeddable/viewport/dashboard_viewport.test.tsx index bbc8031d86a7..f35725cc75a9 100644 --- a/src/plugins/dashboard/public/application/embeddable/viewport/dashboard_viewport.test.tsx +++ b/src/plugins/dashboard/public/application/embeddable/viewport/dashboard_viewport.test.tsx @@ -33,6 +33,7 @@ import React from 'react'; import { skip } from 'rxjs/operators'; import { mount } from 'enzyme'; import { I18nProvider } from '@osd/i18n/react'; +import sizeMe from 'react-sizeme'; import { nextTick } from 'test_utils/enzyme_helpers'; import { DashboardViewport, DashboardViewportProps } from './dashboard_viewport'; import { DashboardContainer, DashboardContainerOptions } from '../dashboard_container'; @@ -45,13 +46,13 @@ import { OpenSearchDashboardsContextProvider } from '../../../../../opensearch_d import { embeddablePluginMock } from 'src/plugins/embeddable/public/mocks'; import { applicationServiceMock } from '../../../../../../core/public/mocks'; +sizeMe.noPlaceholders = true; + let dashboardContainer: DashboardContainer | undefined; const ExitFullScreenButton = () =>
EXIT
; -function getProps( - props?: Partial -): { +function getProps(props?: Partial): { props: DashboardViewportProps; options: DashboardContainerOptions; } {