formations/javascript/angular/exercices/karma/test/ExoControllerSpec.js
2019-03-25 13:14:16 +01:00

30 lines
566 B
JavaScript

describe('ExoController', function() {
beforeEach(module('myApp'));
var $controller;
beforeEach(inject(function(_$controller_){
$controller = _$controller_;
}));
describe('$scope.add', function() {
it('Il additionne les valeurs $scope.val1 et $scope.val2 et stocke le résultat dans $scope.result', function() {
var $scope = {};
var controller = $controller('ExoCtrl', {$scope: $scope});
$scope.val1 = 2;
$scope.val2 = 4;
$scope.add();
expect($scope.result).toEqual(6);
});
});
});