From 534269c5cdfbc6908dc75c6110f681643daaaa57 Mon Sep 17 00:00:00 2001 From: SuZhou-Joe Date: Mon, 23 Oct 2023 17:04:13 +0800 Subject: [PATCH] Feature: create management / public workspaces when calling list api (#236) * feat: create management / public workspaces when calling list api Signed-off-by: SuZhou-Joe * feat: fix bootstrap Signed-off-by: SuZhou-Joe * fix: integration test Signed-off-by: SuZhou-Joe * fix: flaky test Signed-off-by: SuZhou-Joe --------- Signed-off-by: SuZhou-Joe (cherry picked from commit 8ff9e8839813b701057b4c76269f35943944fdab) --- .../public/application/components/import_flyout.test.tsx | 9 ++++++--- .../workspace/server/integration_tests/routes.test.ts | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/plugins/console/public/application/components/import_flyout.test.tsx b/src/plugins/console/public/application/components/import_flyout.test.tsx index 5e7093fe306c..f04678155405 100644 --- a/src/plugins/console/public/application/components/import_flyout.test.tsx +++ b/src/plugins/console/public/application/components/import_flyout.test.tsx @@ -10,6 +10,7 @@ import { ContextValue, ServicesContextProvider } from '../contexts'; import { serviceContextMock } from '../contexts/services_context.mock'; import { wrapWithIntl, nextTick } from 'test_utils/enzyme_helpers'; import { ReactWrapper, mount } from 'enzyme'; +import { waitFor } from '@testing-library/dom'; const mockFile = new File(['{"text":"Sample JSON data"}'], 'sample.json', { type: 'application/json', @@ -122,9 +123,11 @@ describe('ImportFlyout Component', () => { expect(component.find(overwriteOptionIdentifier).first().props().checked).toBe(false); // should update existing query - expect(mockUpdate).toBeCalledTimes(1); - expect(mockClose).toBeCalledTimes(1); - expect(mockRefresh).toBeCalledTimes(1); + await waitFor(() => { + expect(mockUpdate).toBeCalledTimes(1); + expect(mockClose).toBeCalledTimes(1); + expect(mockRefresh).toBeCalledTimes(1); + }); }); it('should handle errors during import', async () => { diff --git a/src/plugins/workspace/server/integration_tests/routes.test.ts b/src/plugins/workspace/server/integration_tests/routes.test.ts index 4d2b50e02f06..73af12d9d24c 100644 --- a/src/plugins/workspace/server/integration_tests/routes.test.ts +++ b/src/plugins/workspace/server/integration_tests/routes.test.ts @@ -186,7 +186,7 @@ describe('workspace service', () => { page: 1, }) .expect(200); - expect(listResult.body.result.total).toEqual(1); + expect(listResult.body.result.total).toEqual(3); }); }); });