import { inject , TestBed } from "@angular/core/testing" ; import { WindowService } from "./window.service" ; import { MediaObserver } from "@angular/flex-layout" ; describe ( "WindowService" , ( ) => { let service ; beforeEach ( ( done ) => { TestBed . configureTestingModule ( { providers : [ WindowService , MediaObserver ] } ) ; service = TestBed . get ( WindowService ) ; done ( ) ; } ) ; it ( "should be created" , inject ( [ WindowService ] , ( service ) => { expect ( service ) . toBeTruthy ( ) ; } ) ) ; it ( "should notify subscribers when windows is resized" , ( done ) => { const expectedCallCount = 1 ; const spy = spyOn ( service . resizing , "next" ) ; service . onResize ( ) ; expect ( spy ) . toHaveBeenCalledTimes ( expectedCallCount ) ; done ( ) ; } ) ; } ) ;