我刚开始使用Angular 2测试服务,并且尝试使用Http基本请求(Get和GetBYId)测试服务。 -我的服务如何运作? :我有一个getAllMyProducts方法,该方法使用Spring Boot后端应用程序中公开的REST Api。此Web api查询产品并返回当前用户的产品。(HTTP请求带有标头发送)。 - 我想做的事? :现在,我必须使用Jasmine测试此GetAll方法,并且我不确定如何执行此操作,尤其是对于当前用户……
getAll(): Observable<Product[]> {
return this.baseapiService.getAll('/product/userProducts');
}
getAll(link){
this.header = this.createHeader();
return this.http.get(this.apiurl+link, this.header)
.map(this.extractData);
}
任何评论或建议都会很棒。预先感谢