单元测试用例失败,因为预期收到

时间:2019-05-03 23:51:51

标签: javascript angular unit-testing jasmine

所以,我知道为什么我的单元测试失败了。但是我想知道是否有什么好的方法可以解决这个问题。请找到下面的代码。谢谢!

//测试用例

it('it should get data from ContactInfoSelection endpoint based on the url 
inputted', () => {
const url ='contact-info-selection';
const { service, get } = spectator;
const http = get<HttpClient>(HttpClient).get.and.returnValue(of());
service.getserviceResponse(url).subscribe(); 
expect(http.calls.first().args[0]).toEqual(
  environment.urls.ContactInfoSelection
); });

//我得到的错误:

- Expected
+ Received

- https://localhost/contact-info-selection
+ contact-info-selection

0 个答案:

没有答案