import React from 'react' ; import { OverviewPageHeader } from './overview_page_header' ; import { shallowWithIntl } from 'test_utils/enzyme_helpers' ; jest . mock ( '../../app_links' , ( ) => ( { RedirectAppLinks : jest . fn ( ( element ) => element ) , } ) ) ; jest . mock ( '../../context' , ( ) => ( { useOpenSearchDashboards : jest . fn ( ) . mockReturnValue ( { services : { application : { capabilities : { navLinks : { management : true , dev_tools : true } } } , notifications : { toast : { addSuccess : jest . fn ( ) } } , } , } ) , } ) ) ; afterAll ( ( ) => jest . clearAllMocks ( ) ) ; const mockTitle = 'Page Title' ; const addBasePathMock = jest . fn ( ( path ) => ( path ? path : 'path' ) ) ; describe ( 'OverviewPageHeader ' , ( ) => { describe ( 'in default mode ' , ( ) => { test ( 'render logo as custom default mode logo' , ( ) => { const branding = { darkMode : false , mark : { defaultUrl : '/defaultModeLogo' , darkModeUrl : '/darkModeLogo' , } , } ; const component = shallowWithIntl ( < OverviewPageHeader addBasePath = { addBasePathMock } title = { mockTitle } branding = { branding } / > ) ; expect ( component ) . toMatchSnapshot ( ) ; } ) ; test ( 'render logo as original default mode opensearch mark' , ( ) => { const branding = { darkMode : false , mark : { } , } ; const component = shallowWithIntl ( < OverviewPageHeader addBasePath = { addBasePathMock } title = { mockTitle } branding = { branding } / > ) ; expect ( component ) . toMatchSnapshot ( ) ; } ) ; } ) ; describe ( 'in dark mode ' , ( ) => { test ( 'render logo as custom dark mode logo' , ( ) => { const branding = { darkMode : false , mark : { defaultUrl : '/defaultModeLogo' , darkModeUrl : '/darkModeLogo' , } , } ; const component = shallowWithIntl ( < OverviewPageHeader addBasePath = { addBasePathMock } title = { mockTitle } branding = { branding } / > ) ; expect ( component ) . toMatchSnapshot ( ) ; } ) ; test ( 'render logo as custom default mode logo' , ( ) => { const branding = { darkMode : false , mark : { defaultUrl : '/defaultModeLogo' , } , } ; const component = shallowWithIntl ( < OverviewPageHeader addBasePath = { addBasePathMock } title = { mockTitle } branding = { branding } / > ) ; expect ( component ) . toMatchSnapshot ( ) ; } ) ; test ( 'render logo as original dark mode opensearch mark' , ( ) => { const branding = { darkMode : false , mark : { } , } ; const component = shallowWithIntl ( < OverviewPageHeader addBasePath = { addBasePathMock } title = { mockTitle } branding = { branding } / > ) ; expect ( component ) . toMatchSnapshot ( ) ; } ) ; } ) ; } ) ;