Created
July 31, 2017 11:32
-
-
Save frederikprijck/7e756095b688240f72ca1c0bc5fc1e1f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { | |
inject, | |
TestBed | |
} from '@angular/core/testing'; | |
import { AppComponent } from './app.container'; | |
import { AppSandbox } from '../../core.sandbox'; | |
import { Observable } from 'rxjs/Observable'; | |
describe('App', () => { | |
beforeEach(() => TestBed.configureTestingModule({ | |
providers: [ | |
{ provide: AppSandbox, useValue: { | |
checkAuthentication: () => {}, | |
currentUser$: Observable.of({}), | |
isLoading: Observable.of({})} | |
}, | |
AppComponent | |
]})); | |
it('should exist', inject([ AppComponent ], (app: AppComponent) => { | |
expect(app).toBeTruthy(); | |
})); | |
it('should call AppSandbox.checkAuthentication on init', inject([ | |
AppComponent, | |
AppSandbox | |
], (component: AppComponent, sb: AppSandbox) => { | |
spyOn(sb, 'checkAuthentication').and.stub(); | |
component.ngOnInit(); | |
expect(sb.checkAuthentication).toHaveBeenCalled(); | |
})); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment