I've got a problem with unit tests using karma.
$httpBackend.expectPUT(envConfig.restUrl + 'customers/1').respond(200);
it('should update"customer details" model', function() {
expect(scope.customerDetails).toBeUndefined();
$httpBackend.flush();
and the response:
Error: Unsatisfied requests: PUT undefinedcustomers/1
at Function.$httpBackend.verifyNoOutstandingExpectation
Your envConfig.restUrl
is not defined.
As per @KrzysztofSafjanowski comment you're also not calling a function which might do that PUT
request or doing that manually. Changing it to whenPUT
might fix that :
$httpBackend.whenPUT(envConfig.restUrl + 'customers/1').respond(200);
it('should update"customer details" model', function() {
expect(scope.customerDetails).toBeUndefined();
$httpBackend.flush();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.