ho angularJs regolatoreDurante il test angularjs regolatore - Non riesci a trovare variabile: Modulo/Inject da faccia tosta
angular.module('App.ctrl.guests', [])
.controller('guestsController', ['$scope', '$http', '$location', '$timeout', 'guestsService', function ($scope, $http, $location, $timeout, guestsService) {
$scope.tiles = [];
}])
e gelsomino prova
/// <reference path="~/Scripts/angular.js" />
/// <reference path="../../ProjectWeb/Scripts/app/guests/guestsCtrl.js" />
/// <reference path="~/Scripts/angular-mocks.js" />
/// <reference path="~/Scripts/jasmine.js" />
'use strict';
describe('App.ctrl.guests', function() {
var scope, controller;
beforeEach(function() {
module('App.ctrl.guests')
});
beforeEach(inject(function ($rootScope, $controller) {
scope = $rootScope.$new();
controller = $controller('guestsController', {
$scope: scope
});
}));
it('should have empty array', function() {
expect(scope.tiles).toBe([]);
});
})
e ogni volta che corro in Visual Studio faccia tosta i get:
ReferenceError: Can't find variable: module in file:///.../JasmineTests/guestsControllerTest.js (line 5)
ReferenceError: Can't find variable: inject in file:///.../JasmineTests/guestsControllerTest.js (line 12)
è Thera un problema con angular.js di riferimento e gelsomino non so cosa è un modulo/Inject ke ywords? È la mia prima volta con js testing:/
Avete incluso riferimenti alle librerie? Non sto usando Visual Studio ma penso che questo ragazzo stia facendo la stessa configurazione di http://www.rosher.co.uk/post/2013/10/22/Unit-Testing-AngularJS-with-Jasmine-Chutzpah-and -Visual-Studio.aspx – GillesC
Sì, aggiungo riferimenti, aggiorno il codice. – netmajor
Grazie, gillesc, in questo articolo sono riuscito a trascinare e rilasciare i file js per testare il file e ora i percorsi sono corretti;) – netmajor