diff --git a/x-pack/plugins/enterprise_search/public/applications/__mocks__/kea_logic/kibana_logic.mock.ts b/x-pack/plugins/enterprise_search/public/applications/__mocks__/kea_logic/kibana_logic.mock.ts index ff4760c11f5c..a4e5bfeae015 100644 --- a/x-pack/plugins/enterprise_search/public/applications/__mocks__/kea_logic/kibana_logic.mock.ts +++ b/x-pack/plugins/enterprise_search/public/applications/__mocks__/kea_logic/kibana_logic.mock.ts @@ -31,6 +31,7 @@ export const mockKibanaValues = { guidedOnboarding: {}, history: mockHistory, isCloud: false, + isSidebarEnabled: true, navigateToUrl: jest.fn(), productAccess: { hasAppSearchAccess: true, diff --git a/x-pack/plugins/enterprise_search/public/applications/index.test.tsx b/x-pack/plugins/enterprise_search/public/applications/index.test.tsx index 0915e17ac6ab..be5d263d531c 100644 --- a/x-pack/plugins/enterprise_search/public/applications/index.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/index.test.tsx @@ -33,6 +33,7 @@ describe('renderApp', () => { licensing: licensingMock.createStart(), security: securityMock.createStart(), }, + isSidebarEnabled: true, } as any; const pluginData = { config: {}, diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/layout/nav.test.tsx b/x-pack/plugins/enterprise_search/public/applications/shared/layout/nav.test.tsx index 4db2e43c51fb..e220736bb0ac 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/layout/nav.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/shared/layout/nav.test.tsx @@ -105,7 +105,7 @@ describe('useEnterpriseSearchContentNav', () => { mockKibanaValues.uiSettings.get.mockReturnValue(false); const esNav = useEnterpriseSearchNav(); - const searchNav = esNav.find((item) => item.id === 'search'); + const searchNav = esNav?.find((item) => item.id === 'search'); expect(searchNav).not.toBeUndefined(); expect(searchNav).toEqual({ id: 'search', @@ -135,7 +135,7 @@ describe('useEnterpriseSearchContentNav', () => { setMockValues({ productAccess: workplaceSearchProductAccess }); const esNav = useEnterpriseSearchNav(); - const searchNav = esNav.find((item) => item.id === 'search'); + const searchNav = esNav?.find((item) => item.id === 'search'); expect(searchNav).not.toBeUndefined(); expect(searchNav).toEqual({ id: 'search', @@ -170,7 +170,7 @@ describe('useEnterpriseSearchContentNav', () => { setMockValues({ productAccess: appSearchProductAccess }); const esNav = useEnterpriseSearchNav(); - const searchNav = esNav.find((item) => item.id === 'search'); + const searchNav = esNav?.find((item) => item.id === 'search'); expect(searchNav).not.toBeUndefined(); expect(searchNav).toEqual({ id: 'search', @@ -204,7 +204,7 @@ describe('useEnterpriseSearchContentNav', () => { setMockValues({ productAccess: fullProductAccess }); const esNav = useEnterpriseSearchNav(); - expect(esNav.find((item) => item.id === 'enginesSearch')).toBeUndefined(); + expect(esNav?.find((item) => item.id === 'enginesSearch')).toBeUndefined(); }); }); @@ -304,7 +304,7 @@ describe('useEnterpriseSearchContentNav Engines feature flag', () => { setMockValues({ productAccess: fullProductAccess }); const esNav = useEnterpriseSearchNav(); - expect(esNav.find((item) => item.id === 'standaloneExperiences')).toBeUndefined(); + expect(esNav?.find((item) => item.id === 'standaloneExperiences')).toBeUndefined(); }); it('excludes App Search when the user has no access to it', () => { const fullProductAccess: ProductAccess = { @@ -315,7 +315,7 @@ describe('useEnterpriseSearchContentNav Engines feature flag', () => { setMockValues({ productAccess: fullProductAccess }); const esNav = useEnterpriseSearchNav(); - const standAloneNav = esNav.find((item) => item.id === 'standaloneExperiences'); + const standAloneNav = esNav?.find((item) => item.id === 'standaloneExperiences'); expect(standAloneNav).not.toBeUndefined(); expect(standAloneNav).toEqual({ id: 'standaloneExperiences', @@ -338,7 +338,7 @@ describe('useEnterpriseSearchContentNav Engines feature flag', () => { setMockValues({ productAccess: fullProductAccess }); const esNav = useEnterpriseSearchNav(); - const standAloneNav = esNav.find((item) => item.id === 'standaloneExperiences'); + const standAloneNav = esNav?.find((item) => item.id === 'standaloneExperiences'); expect(standAloneNav).not.toBeUndefined(); expect(standAloneNav).toEqual({ id: 'standaloneExperiences', @@ -444,14 +444,14 @@ describe('useEnterpriseSearchEngineNav', () => { it('returns selected engine sub nav items', () => { const engineName = 'my-test-engine'; const navItems = useEnterpriseSearchEngineNav(engineName); - expect(navItems.map((ni) => ni.name)).toEqual([ + expect(navItems?.map((ni) => ni.name)).toEqual([ 'Overview', 'Content', 'Search', 'Behavioral Analytics', 'Standalone Experiences', ]); - const searchItem = navItems.find((ni) => ni.id === 'enginesSearch'); + const searchItem = navItems?.find((ni) => ni.id === 'enginesSearch'); expect(searchItem).not.toBeUndefined(); expect(searchItem!.items).not.toBeUndefined(); // @ts-ignore @@ -501,14 +501,14 @@ describe('useEnterpriseSearchEngineNav', () => { it('returns selected engine without tabs when isEmpty', () => { const engineName = 'my-test-engine'; const navItems = useEnterpriseSearchEngineNav(engineName, true); - expect(navItems.map((ni) => ni.name)).toEqual([ + expect(navItems?.map((ni) => ni.name)).toEqual([ 'Overview', 'Content', 'Search', 'Behavioral Analytics', 'Standalone Experiences', ]); - const searchItem = navItems.find((ni) => ni.id === 'enginesSearch'); + const searchItem = navItems?.find((ni) => ni.id === 'enginesSearch'); expect(searchItem).not.toBeUndefined(); expect(searchItem!.items).not.toBeUndefined(); // @ts-ignore diff --git a/x-pack/plugins/security/public/management/management_service.test.ts b/x-pack/plugins/security/public/management/management_service.test.ts index 49fdd6864ec3..7e0eef83cca1 100644 --- a/x-pack/plugins/security/public/management/management_service.test.ts +++ b/x-pack/plugins/security/public/management/management_service.test.ts @@ -25,6 +25,7 @@ import { rolesManagementApp } from './roles'; import { usersManagementApp } from './users'; const mockSection = createManagementSectionMock(); +const mockSetIsSidebarEnabled = (enabled: boolean) => {}; describe('ManagementService', () => { describe('setup()', () => { @@ -41,6 +42,7 @@ describe('ManagementService', () => { } as DefinedSections, }, locator: {} as any, + setIsSidebarEnabled: mockSetIsSidebarEnabled, }; const service = new ManagementService(); @@ -103,6 +105,7 @@ describe('ManagementService', () => { } as DefinedSections, }, locator: {} as any, + setIsSidebarEnabled: mockSetIsSidebarEnabled, }; service.setup({