cost 197 ms
在 angular 中对 http 拦截器进行单元测试时监视方法 - spy on method when unit testing http interceptor in angular

我正在尝试对 http 拦截器进行单元测试。 拦截器用于授权。 我可以测试基本的成功案例,但我现在正在尝试测试 API 调用失败的案例,因为访问令牌已过期。 我的问题是,如何监视 AuthInterceptorService.getNewTokenAndRetryRequest() 方法? 我的拦截 ...

如何使用多 http 调用测试方法 - How to test a method with multi-http calls

如何使用httpTestingController测试findArtists方法? 因此,理想情况下,该服务所做的是在第一次 get 调用时获取一些艺术家的数据,但返回的数据并不包含在模板中显示所需的所有数据。 因此,这就是我在 switchMap 中映射更多 HTTP 调用的原因,因为这些后续调用 ...

Angular 单元测试 - 在 HttpInterceptor 中测试 retryWhen - Angular unit test - testing retryWhen in HttpInterceptor

我正在尝试在 http 拦截器中测试 retryWhen 运算符,但是在尝试多次重复我的服务调用时出现错误: “错误:预期有一个对标准“匹配 URL: http://someurl/tesdata ”的匹配请求,但没有找到。” 所以我有2个问题。 首先,我是否要以正确的方式进行测试,其次,为什么 ...

包含HTTP订阅的服务方法的测试用例-Angular HTTP RxJs - Test case for a service method which contains a HTTP subscribe - Angular HTTP RxJs

我有一个服务方法,它有一个服务调用(HTTP调用),它立即订阅,并根据响应代码执行其余的action命令。 示例:服务方法 我尝试了以下示例(测试用例) 请协助我处理这种情况。 ...


 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM