lundi 22 mai 2017

angular test Unexpected request: GET template

I trying to test directive, a have activate() function, that calls another functions, on error it call ngDialog.open()

ngDialog.open({
      template: 'path/to/template/error.html',
      className: 'ngdialog-theme-default',
      data: data
    });

and here is my test:

   it('should check activate function', function() {
          $httpBackend.whenGET('path/to/template/error.html').respond(200, '');
          var onActivateSpy = spyOn(scope.$$childTail.headerVm, 'activate'));
    expect(onActivateSpy).toHaveBeenCalled();
    });

and I have an error: Error: Unexpected request: GET path/to/template/error.html what I missed?

EDITED here is my beforeeach:

beforeEach(function () {
      module('app');
      module('path/to/template/error.html');
    });

and I using ng-html2js preprocessor

Aucun commentaire:

Enregistrer un commentaire