mardi 8 septembre 2015

AngularJS HTTPBackend flush() fails test

I'm running angular unit tests on Karma, and have the following:

beforeEach(function () {
  httpBackend.when('GET', 'language/en_UK.json').respond({});
  httpBackend.expectGET('language/en_UK.json');
  httpBackend.flush();

  httpBackend.verifyNoOutstandingExpectation();
  httpBackend.verifyNoOutstandingRequest();
  httpBackend.resetExpectations();
});

This test will fail with just the error element is null on the line httpBackend.flush();. What could cause this?

Aucun commentaire:

Enregistrer un commentaire