import { inject , TestBed } from "@angular/core/testing" ; import { SideNavService } from "./side-nav.service" ; import { SideNavStatus } from "./side-nav-status.enum" ; describe ( "SideNavService" , ( ) => { let service ; beforeEach ( ( done ) => { TestBed . configureTestingModule ( { providers : [ SideNavService ] } ) ; service = TestBed . get ( SideNavService ) ; done ( ) ; } ) ; it ( "should be created" , inject ( [ SideNavService ] , ( service ) => { expect ( service ) . toBeTruthy ( ) ; } ) ) ; it ( "should notify subscribers when side nav is closed" , ( done ) => { const expectedCallCount = 1 ; const spy = spyOn ( service . changes , "next" ) ; service . onChange ( SideNavStatus . CLOSED ) ; expect ( spy ) . toHaveBeenCalledTimes ( expectedCallCount ) ; expect ( spy ) . toHaveBeenCalledWith ( SideNavStatus . CLOSED ) ; done ( ) ; } ) ; it ( "should notify subscribers when side nav is opened" , ( done ) => { const expectedCallCount = 1 ; const spy = spyOn ( service . changes , "next" ) ; service . onChange ( SideNavStatus . OPENED ) ; expect ( spy ) . toHaveBeenCalledTimes ( expectedCallCount ) ; expect ( spy ) . toHaveBeenCalledWith ( SideNavStatus . OPENED ) ; done ( ) ; } ) ; } ) ;