预期对标准“匹配URL”的一个匹配请求(Angular 4+)

时间:2019-09-18 22:44:18

标签: javascript angular testing jasmine karma-runner

我收到此错误消息,但不知道为什么:

  

错误:对于标准“匹配URL:http://someurl”,预期有一个匹配请求,但找不到。

it('getUserList() should return something ', () => {
    const mockList = [{
      avatar: '',
      status: 'Pending',
      email: 'asdasdasd@gmail.com',
      name: 'Mikey',
      userName: 'adkadasd@gmail.com',
      roles: 'id_full_admin',
      onboardDate: '2019-09-16T22:40:14.975Z',
      id: 'kkasadasdasd'
    }];
    const userId = '7de54d40-ftf7-4433-96be-b29957a5111d';
    const link = `${service.getBlahService().getUrl('UserServiceUrl')}/identity/scim/${userId}/v1/Users?&attributes=name,userName,userStatus,entitlements,displayName,photos,roles,active,trainSiteNames,linkedTrainSiteNames,licenseID,userSettings,userPreferences&filter=active%20eq%false%20or%20displayName%20sw%20%22xz%22&count=100&sortBy=name&sortOrder=ascending`;
    const req = httpMock.expectOne(link);

    service.getUsersList(userId).subscribe((res) => {
      expect(res).toEqual(mockList);
    });

    expect(req.request.method).toBe('GET');
    req.flush(mockList);
  });
});

0 个答案:

没有答案