angular 8 spyon observable errorrgument of type 'Observable<{}>' is not assignable to parameter of type 'Promise<boolean>'. Type 'Observable<{}>' is missing the following properties from type 'Promise<boolean>': then, [Symbol.toStringTag] code example

Example: jasmine spyon argument of type is not assignable to parameter of type 'prototype'

const service = TestBed.get(GAService);
spyOn(service , "sendException").and.returnValue(Promise.resolve(true));

// do some stuff that is expected to invoke GAService.sendException

expect(service.sendException).toHaveBeenCalled();

Tags:

Misc Example