unit testing spyOn observable service in angular2

前端 未结 2 1231
后悔当初
后悔当初 2021-01-07 21:41

I have a service (ChildService) which depends on another service (InteractWithServerService). The latter service (InteractWithServerService) is used to make server calls and

2条回答
  •  囚心锁ツ
    2021-01-07 22:00

    Using jasmin 2.6.2: get is a function so you need to add the arrow function notation to the answer above:

    providers: [
      { 
        provide: InteractWithServerService,
        useValue: { get: () => Observable.of(..) }
      }
    ]
    

提交回复
热议问题