Angular 5 Jasmine Error: Expected one matching request for criteria found none

后端 未结 4 1446
一生所求
一生所求 2021-01-04 05:34

I have a very simple service call and a jasmine test for it.

Service call:

myServiceCall(testId: number) : void {
    const url = `${this.url}/param         


        
4条回答
  •  独厮守ぢ
    2021-01-04 06:18

    My problem is solved. After I added to params to the URL (if you use params).

    let results = { param: 'results', value: '50' };
    url = `${api.url}${route.url}?${results.param}=${results.value}`;
    

    HttpTestingController always display only URL without params, but if used expectOne(url) it use a URL with query string like that: http://example.com/path/to/page?name=ferret&color=purple

提交回复
热议问题