From ac83477a8845617e26e610c27f24ad0617e80a62 Mon Sep 17 00:00:00 2001 From: Gustavo Cortez Date: Mon, 23 Jun 2014 19:45:04 -0300 Subject: [PATCH] Test for getNumber function. --- test/unit/controllers/controllersSpec.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/test/unit/controllers/controllersSpec.js b/test/unit/controllers/controllersSpec.js index b41524a74..03c6d0c51 100644 --- a/test/unit/controllers/controllersSpec.js +++ b/test/unit/controllers/controllersSpec.js @@ -55,6 +55,23 @@ describe("Unit: Controllers", function() { }); }); + describe('Setup Controller', function() { + var setupCtrl; + beforeEach(inject(function($controller, $rootScope) { + scope = $rootScope.$new(); + setupCtrl = $controller('SetupController', { + $scope: scope, + }); + })); + + it('should return an array of n undefined elements', function() { + var n = 5; + var array = scope.getNumber(n); + expect(array.length).equal(n); + }); + + }); + describe('Address Controller', function() { var addressCtrl; beforeEach(inject(function($controller, $rootScope) { @@ -212,6 +229,13 @@ describe("Unit: Controllers", function() { scope.$apply(); }); + it('should return an array of n undefined elements', function() { + $httpBackend.flush(); // need flush + var n = 5; + var array = scope.getNumber(n); + expect(array.length).equal(n); + }); + }); describe('Send Controller', function() {