diff --git a/x-pack/plugins/security_solution/public/common/components/landing_page/index.tsx b/x-pack/plugins/security_solution/public/common/components/landing_page/index.tsx index b21cf5dc8b792..310420524040d 100644 --- a/x-pack/plugins/security_solution/public/common/components/landing_page/index.tsx +++ b/x-pack/plugins/security_solution/public/common/components/landing_page/index.tsx @@ -16,3 +16,5 @@ export const LandingPageComponent = memo(() => { ); }); + +LandingPageComponent.displayName = 'LandingPageComponent'; diff --git a/x-pack/plugins/security_solution/public/common/components/link_to/redirect_to_landing.tsx b/x-pack/plugins/security_solution/public/common/components/link_to/redirect_to_landing.tsx index 2f44700b12ab4..cc28f1b5ebd95 100644 --- a/x-pack/plugins/security_solution/public/common/components/link_to/redirect_to_landing.tsx +++ b/x-pack/plugins/security_solution/public/common/components/link_to/redirect_to_landing.tsx @@ -7,5 +7,5 @@ import { appendSearch } from './helpers'; -export const getAppLandingUrl = (overviewPath: string, search?: string) => - `${overviewPath}${appendSearch(search)}`; +export const getAppLandingUrl = (path: string, search?: string) => + `${path}${appendSearch(search)}`; diff --git a/x-pack/plugins/security_solution/public/hosts/pages/hosts.test.tsx b/x-pack/plugins/security_solution/public/hosts/pages/hosts.test.tsx index d66a3fc2f1d95..0165fb95c308e 100644 --- a/x-pack/plugins/security_solution/public/hosts/pages/hosts.test.tsx +++ b/x-pack/plugins/security_solution/public/hosts/pages/hosts.test.tsx @@ -100,9 +100,17 @@ describe('Hosts - rendering', () => { ); + + const getUrlForAppMock = ( + appId: string, + options?: { deepLinkId?: string; path?: string; absolute?: boolean } + ) => `${appId}${options?.deepLinkId ? `/${options.deepLinkId}` : ''}${options?.path ?? ''}`; + + const landingPath = getUrlForAppMock(APP_UI_ID, { deepLinkId: SecurityPageName.landing }); + expect(mockNavigateToApp).toHaveBeenCalledWith(APP_UI_ID, { deepLinkId: SecurityPageName.landing, - path: getAppLandingUrl(), + path: getAppLandingUrl(landingPath), }); }); diff --git a/x-pack/plugins/security_solution/public/network/pages/network.test.tsx b/x-pack/plugins/security_solution/public/network/pages/network.test.tsx index 59be2e08bd7b6..4dff02b2ddaef 100644 --- a/x-pack/plugins/security_solution/public/network/pages/network.test.tsx +++ b/x-pack/plugins/security_solution/public/network/pages/network.test.tsx @@ -26,7 +26,7 @@ import { Network } from './network'; import { NetworkRoutes } from './navigation'; import { mockCasesContract } from '../../../../cases/public/mocks'; import { APP_UI_ID, SecurityPageName } from '../../../common/constants'; -import { getAppLandingUrl } from '../../common/components/link_to'; +import { getAppLandingUrl } from '../../common/components/link_to/redirect_to_landing'; jest.mock('../../common/containers/sourcerer'); @@ -133,9 +133,16 @@ describe('Network page - rendering', () => { ); + const getUrlForAppMock = ( + appId: string, + options?: { deepLinkId?: string; path?: string; absolute?: boolean } + ) => `${appId}${options?.deepLinkId ? `/${options.deepLinkId}` : ''}${options?.path ?? ''}`; + + const landingPath = getUrlForAppMock(APP_UI_ID, { deepLinkId: SecurityPageName.landing }); + expect(mockNavigateToApp).toHaveBeenCalledWith(APP_UI_ID, { deepLinkId: SecurityPageName.landing, - path: getAppLandingUrl(SecurityPageName.landing), + path: getAppLandingUrl(landingPath), }); }); diff --git a/x-pack/plugins/security_solution/public/overview/pages/overview.test.tsx b/x-pack/plugins/security_solution/public/overview/pages/overview.test.tsx index 040d213f04882..aebde7c980fe3 100644 --- a/x-pack/plugins/security_solution/public/overview/pages/overview.test.tsx +++ b/x-pack/plugins/security_solution/public/overview/pages/overview.test.tsx @@ -311,10 +311,16 @@ describe('Overview', () => { ); + const getUrlForAppMock = ( + appId: string, + options?: { deepLinkId?: string; path?: string; absolute?: boolean } + ) => `${appId}${options?.deepLinkId ? `/${options.deepLinkId}` : ''}${options?.path ?? ''}`; + + const landingPath = getUrlForAppMock(APP_UI_ID, { deepLinkId: SecurityPageName.landing }); expect(mockNavigateToApp).toHaveBeenCalledWith(APP_UI_ID, { deepLinkId: SecurityPageName.landing, - path: getAppLandingUrl(), + path: getAppLandingUrl(landingPath), }); }); }); diff --git a/x-pack/plugins/security_solution/public/users/pages/users_tabs.test.tsx b/x-pack/plugins/security_solution/public/users/pages/users_tabs.test.tsx index 2915e78988fd2..1bd2c22a07ffd 100644 --- a/x-pack/plugins/security_solution/public/users/pages/users_tabs.test.tsx +++ b/x-pack/plugins/security_solution/public/users/pages/users_tabs.test.tsx @@ -85,9 +85,16 @@ describe('Users - rendering', () => { ); + const getUrlForAppMock = ( + appId: string, + options?: { deepLinkId?: string; path?: string; absolute?: boolean } + ) => `${appId}${options?.deepLinkId ? `/${options.deepLinkId}` : ''}${options?.path ?? ''}`; + + const landingPath = getUrlForAppMock(APP_UI_ID, { deepLinkId: SecurityPageName.landing }); + expect(mockNavigateToApp).toHaveBeenCalledWith(APP_UI_ID, { deepLinkId: SecurityPageName.landing, - path: getAppLandingUrl(), + path: getAppLandingUrl(landingPath), }); });