我是使用Angular 2测试服务的新手,我正在尝试使用Http基本请求测试服务(Get和GetBYId) . - 我的服务如何运作? :我有一个getAllMyProducts方法,它使用Spring引导后端应用程序中暴露的REST Api . 这个web api查询产品并返回当前用户的产品 . (http请求随头文件一起发送) . - 我想做的事? :现在我必须使用Jasmine测试这个GetAll方法,我不知道如何做到这一点,尤其是对于当前用户...

  • 我的服务中的GetAllMethod:
getAll(): Observable<Product[]> {
    return this.baseapiService.getAll('/product/userProducts');
    }
  • 我的baseapiService将标头附加到请求:
getAll(link){
    this.header = this.createHeader();
    return this.http.get(this.apiurl+link, this.header)
      .map(this.extractData);
  }

任何考试或建议都会很棒 . 提前致谢