import { of } from 'rxjs' ; import { SpyObject } from './spyobject' ; import { AccountService } from 'app/core/auth/account.service' ; import Spy = jasmine . Spy ; export class MockAccountService extends SpyObject { getSpy : Spy ; saveSpy : Spy ; fakeResponse : any ; identitySpy : Spy ; getAuthenticationStateSpy : Spy ; constructor ( ) { super ( AccountService ) ; this . fakeResponse = null ; this . getSpy = this . spy ( 'get' ) . andReturn ( this ) ; this . saveSpy = this . spy ( 'save' ) . andReturn ( this ) ; this . setIdentitySpy ( { } ) ; } subscribe ( callback ) { callback ( this . fakeResponse ) ; } setResponse ( json ) { this . fakeResponse = json ; } setIdentitySpy ( json ) { this . identitySpy = this . spy ( 'identity' ) . andReturn ( Promise . resolve ( json ) ) ; } setIdentityResponse ( json ) { this . setIdentitySpy ( json ) ; this . getAuthenticationStateSpy = this . spy ( 'getAuthenticationState' ) . andReturn ( of ( json ) ) ; } }