Error: : fromEvent is not declared writable or has no setter
You need to spy on a property of rxjs. Using spyOnProperty will solve the error. Try this import * as rxjs from ‘rxjs’ import { of, fromEvent } from ‘rxjs’; spyOnProperty(rxjs, ‘fromEvent’).and.returnValue(of({})) you can also add to getter/setters using this like spyOnProperty(rxjs, ‘fromEvent’, ‘get’).and.returnValue(false) Hope this helps