我有一个使用业力的单元测试的问题。Karma Angular.js单元测试expectPUT
$httpBackend.expectPUT(envConfig.restUrl + 'customers/1').respond(200);
it('should update"customer details" model', function() {
expect(scope.customerDetails).toBeUndefined();
$httpBackend.flush();
和响应:
Error: Unsatisfied requests: PUT undefinedcustomers/1
at Function.$httpBackend.verifyNoOutstandingExpectation
是否定义了'envConfig.restUrl'? –
没有问题 - 你期待PUT调用,但永远不会发生 - '$ httpBackend.flush()'试图刷新所有的请求,但没有挂起的请求。 –
@KrzysztofSafjanowski看看正在请求的URL =>'PUT undefinedcustomers/1' –