Created
August 28, 2017 07:11
-
-
Save adrianfaciu/6d747e4a9e16df6eeab42a0ba9688cff to your computer and use it in GitHub Desktop.
This file contains hidden or 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
function createServiceStub(response: any) { | |
const service = jasmine.createSpyObj('service', [ 'getDummyData' ]); | |
const isError = response instanceof Error; | |
const serviceResponse = isError ? Observable.throw(response) : Observable.of(response); | |
service.getDummyData.and.returnValue(serviceResponse); | |
return service; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment