http istemcimden bazılarını benim sınamada değil, birim sınamada iletmek istiyorum, ancak passThrough() yöntemini çağırmaya çalıştığımda, eksik bir yöntem hatası atılır:
"TypeError: Object # has no method 'passThrough'".
herkes bunu lütfen düzeltebilirim biliyor mu
?kodum yok:
'use strict';
describe('Controller: MainCtrl', function() {
// load the controller's module
beforeEach(module('w00App'));
var scope, MainCtrl, $httpBackend;
// Initialize the controller and a mock scope
beforeEach(inject(function(_$httpBackend_, $rootScope, $controller) {
$httpBackend = _$httpBackend_;
$httpBackend.expectGET('http://api.some.com/testdata.json').passThrough();
scope = $rootScope.$new();
MainCtrl = $controller('MainCtrl', {
$scope: scope
});
}));
});
gibi [belgelerinde] açıklandığı (http://docs.angularjs.org/api/ngMock.$httpBackend): * Birim Testler sırasında, bizim birim testler hızla çalıştırmak istiyorum ve hiçbir harici bağımlılıkları bu yüzden gerçek bir sunucuya XHR veya JSONP istekleri göndermek istemiyoruz *. Ünite testlerinde kullanılan $ httpBackend servisi, üzerinden geçemez. Ancak uçtan uca test tarafından kullanılan $ httpBackend olabilir. –
Bu, harici şablonlarla test direktiflerini gerekenden daha zor hale getirir, sence de öyle değil mi? – SimplGy