Quando provo a utilizzare $ httpBackend.flush(); Ho ricevuto l'errore TypeError: $ browser.cookies non è una funzione. Non riesco a trovare alcuna informazione su questo tipo di errore e su nessuna soluzione.Errore durante il tentativo di utilizzare il gelsomino e l'angolare
describe("someText", function() {
var $httpBackend;
var someManager;
var authRequestHandler;
var dataMockup = [];
beforeEach(function(){
module('app');
inject(function($injector){
$httpBackend = $injector.get('$httpBackend');
someManager = $injector.get('someManager');
authRequestHandler = $httpBackend.when('GET', 'someUrl.php')
.respond(dataMockup);
});
});
it('test first action', function() {
$httpBackend.expectGET('someUrl.php');
messageManager.loadData();
$httpBackend.flush(); // There i got error
});
});
- angolare: 1.3.15
- Jasmine: 2.3.4
Assicurati di avere anche la versione corretta del file di mock angolare. https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.15/angular-mocks.js – PSL
@PSL, grazie. Non l'ho notato. – gregurco