import { of } from 'rxjs' ; import { App , AppNavLinkStatus , AppStatus } from '../types' ; import { getAppInfo } from './get_app_info' ; describe ( 'getAppInfo' , ( ) => { const createApp = ( props = { } ) : App => ( { mount : ( ) => ( ) => undefined , updater$ : of ( ( ) => undefined ) , id : 'some-id' , title : 'some-title' , status : AppStatus . accessible , navLinkStatus : AppNavLinkStatus . default , appRoute : `/app/some-id` , ... props , } ) ; it ( 'converts an application and remove sensitive properties' , ( ) => { const app = createApp ( ) ; const info = getAppInfo ( app ) ; expect ( info ) . toEqual ( { id : 'some-id' , title : 'some-title' , status : AppStatus . accessible , navLinkStatus : AppNavLinkStatus . visible , appRoute : `/app/some-id` , } ) ; } ) ; it ( 'computes the navLinkStatus depending on the app status' , ( ) => { expect ( getAppInfo ( createApp ( { navLinkStatus : AppNavLinkStatus . default , status : AppStatus . inaccessible , } ) ) ) . toEqual ( expect . objectContaining ( { navLinkStatus : AppNavLinkStatus . hidden , } ) ) ; expect ( getAppInfo ( createApp ( { navLinkStatus : AppNavLinkStatus . default , status : AppStatus . accessible , } ) ) ) . toEqual ( expect . objectContaining ( { navLinkStatus : AppNavLinkStatus . visible , } ) ) ; } ) ; } ) ;