import { NO_ERRORS_SCHEMA } from '@angular/core' ; import { TestBed , ComponentFixture } from '@angular/core/testing' ; import { SidenavComponent } from './sidenav.component' ; import { AppTestingModule } from '../../testing/app-testing.module' ; import { AppExtensionService } from '@alfresco/aca-shared' ; describe ( 'SidenavComponent' , ( ) => { let fixture ; let component ; let extensionService ; beforeEach ( ( ) => { TestBed . configureTestingModule ( { imports : [ AppTestingModule ] , declarations : [ SidenavComponent ] , schemas : [ NO_ERRORS_SCHEMA ] } ) ; fixture = TestBed . createComponent ( SidenavComponent ) ; component = fixture . componentInstance ; extensionService = TestBed . inject ( AppExtensionService ) ; extensionService . navbar = [ { id : 'route' , items : [ { id : 'item-1' , icon : 'item' , route : 'route' , title : 'item-1' } ] } ] ; } ) ; it ( 'should set the sidenav data' , async ( ) => { fixture . detectChanges ( ) ; await fixture . whenStable ( ) ; expect ( component . groups . length ) . toBe ( 1 ) ; expect ( component . groups [ 0 ] . items . length ) . toBe ( 1 ) ; expect ( component . groups [ 0 ] . items [ 0 ] ) . toEqual ( { id : 'item-1' , icon : 'item' , url : '/route' , route : 'route' , title : 'item-1' } ) ; } ) ; } ) ;