From 2a5aebea112447717885d861e477da8a42703c82 Mon Sep 17 00:00:00 2001 From: Kawika Avilla Date: Wed, 24 Mar 2021 01:21:18 +0000 Subject: [PATCH] [Tests] A few easy fixes for unit tests ~25 failures still. I need to update the project to just ignore the maps directory completely for tests instead of just ignoring one test. Signed-off-by: Kawika Avilla --- packages/osd-pm/src/utils/project.test.ts | 2 +- .../failed_tests_reporter/issue_metadata.test.ts | 16 +++++----------- .../public/doc_links/doc_links_service.test.ts | 2 +- .../plugins/discovery/plugins_discovery.test.ts | 2 -- .../saved_objects_service.test.mocks.ts | 2 +- .../management_app/lib/get_category_name.test.ts | 2 +- .../components/default_alert.test.tsx | 3 ++- 7 files changed, 11 insertions(+), 18 deletions(-) diff --git a/packages/osd-pm/src/utils/project.test.ts b/packages/osd-pm/src/utils/project.test.ts index ac7ff9be17fd..90546435b431 100644 --- a/packages/osd-pm/src/utils/project.test.ts +++ b/packages/osd-pm/src/utils/project.test.ts @@ -180,7 +180,7 @@ describe('#getExecutables()', () => { }); expect(project.getExecutables()).toEqual({ - opensearchDashboards: resolve(rootPath, 'bin/script.js'), + 'opensearch-dashboards': resolve(rootPath, 'bin/script.js'), }); }); diff --git a/packages/osd-test/src/failed_tests_reporter/issue_metadata.test.ts b/packages/osd-test/src/failed_tests_reporter/issue_metadata.test.ts index 0486bcca1ecf..c049936f4996 100644 --- a/packages/osd-test/src/failed_tests_reporter/issue_metadata.test.ts +++ b/packages/osd-test/src/failed_tests_reporter/issue_metadata.test.ts @@ -26,7 +26,7 @@ const HAS_METADATA = dedent` some text - + `; const HAS_SOME_OTHER_METADATA = dedent` @@ -34,7 +34,7 @@ const HAS_SOME_OTHER_METADATA = dedent` some text - + `; const INVALID_METADATA = dedent` @@ -42,7 +42,7 @@ const INVALID_METADATA = dedent` some text - + `; const MISSING_METADATA = dedent` @@ -88,9 +88,7 @@ describe('updateIssueMetadata', () => { some text - - - " + " `); }); @@ -116,9 +114,7 @@ describe('updateIssueMetadata', () => { some text - - - " + " `); }); @@ -132,8 +128,6 @@ describe('updateIssueMetadata', () => { some text - - " `); }); diff --git a/src/core/public/doc_links/doc_links_service.test.ts b/src/core/public/doc_links/doc_links_service.test.ts index f14b03be2076..1a5ad5df727c 100644 --- a/src/core/public/doc_links/doc_links_service.test.ts +++ b/src/core/public/doc_links/doc_links_service.test.ts @@ -28,7 +28,7 @@ describe('DocLinksService#start()', () => { const api = service.start({ injectedMetadata }); expect(api.DOC_LINK_VERSION).toEqual('test-branch'); expect(api.links.opensearchDashboards).toEqual( - 'https://www.opensearch.co/guide/en/kibana/test-branch/index.html' + 'https://www.opensearch.com/guide/en/kibana/test-branch/index.html' ); }); }); diff --git a/src/core/server/plugins/discovery/plugins_discovery.test.ts b/src/core/server/plugins/discovery/plugins_discovery.test.ts index 804b72c834ff..e62cc727e08f 100644 --- a/src/core/server/plugins/discovery/plugins_discovery.test.ts +++ b/src/core/server/plugins/discovery/plugins_discovery.test.ts @@ -230,11 +230,9 @@ describe('plugins discovery system', () => { .toPromise(); const srcPluginsPath = resolve(OPENSEARCH_DASHBOARDS_ROOT, 'src', 'plugins'); - const xpackPluginsPath = resolve(OPENSEARCH_DASHBOARDS_ROOT, 'x-pack', 'plugins'); expect(errors).toEqual( expect.arrayContaining([ `Error: EACCES, permission denied '${srcPluginsPath}' (invalid-search-path, ${srcPluginsPath})`, - `Error: ENOENT, no such file or directory '${xpackPluginsPath}' (invalid-search-path, ${xpackPluginsPath})`, ]) ); }); diff --git a/src/core/server/saved_objects/saved_objects_service.test.mocks.ts b/src/core/server/saved_objects/saved_objects_service.test.mocks.ts index a461aeca3419..1684aae4f82b 100644 --- a/src/core/server/saved_objects/saved_objects_service.test.mocks.ts +++ b/src/core/server/saved_objects/saved_objects_service.test.mocks.ts @@ -25,7 +25,7 @@ export const migratorInstanceMock = mockOpenSearchDashboardsMigrator.create(); export const OpenSearchDashboardsMigratorMock = jest .fn() .mockImplementation(() => migratorInstanceMock); -jest.doMock('./migrations/opensearch-dashboards/opensearch_dashboards_migrator', () => ({ +jest.doMock('./migrations/opensearch_dashboards/opensearch_dashboards_migrator', () => ({ OpenSearchDashboardsMigrator: OpenSearchDashboardsMigratorMock, })); diff --git a/src/plugins/advanced_settings/public/management_app/lib/get_category_name.test.ts b/src/plugins/advanced_settings/public/management_app/lib/get_category_name.test.ts index 667a5b7d55da..deb3a8281494 100644 --- a/src/plugins/advanced_settings/public/management_app/lib/get_category_name.test.ts +++ b/src/plugins/advanced_settings/public/management_app/lib/get_category_name.test.ts @@ -24,7 +24,7 @@ describe('Settings', function () { describe('Advanced', function () { describe('getCategoryName(category)', function () { it('should capitalize unknown category', function () { - expect(getCategoryName('opensearch')).to.be('OpenSearch'); + expect(getCategoryName('unknown')).to.be('Unknown'); }); it('should return empty string for no category', function () { diff --git a/src/plugins/security_oss/public/insecure_cluster_service/components/default_alert.test.tsx b/src/plugins/security_oss/public/insecure_cluster_service/components/default_alert.test.tsx index b414ab78cdfd..02d7f07c0252 100644 --- a/src/plugins/security_oss/public/insecure_cluster_service/components/default_alert.test.tsx +++ b/src/plugins/security_oss/public/insecure_cluster_service/components/default_alert.test.tsx @@ -19,7 +19,8 @@ import { defaultAlertText } from './default_alert'; -describe('defaultAlertText', () => { +// TODO: Ignoring because the defaultAlertText was commented out because it upsells a hosted solution. +xdescribe('defaultAlertText', () => { it('creates a valid MountPoint that can cleanup correctly', () => { const mountPoint = defaultAlertText(jest.fn());