From 5e1252333890ff83dc42bb4d7f58cba450fe6648 Mon Sep 17 00:00:00 2001 From: Manuel Araoz Date: Thu, 26 Jun 2014 18:37:30 -0300 Subject: [PATCH] fix signin and add tests --- js/controllers/signin.js | 2 +- test/unit/controllers/controllersSpec.js | 31 +++++++++++++++++++++--- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/js/controllers/signin.js b/js/controllers/signin.js index 33f736c9b..b2e6ef0c8 100644 --- a/js/controllers/signin.js +++ b/js/controllers/signin.js @@ -1,7 +1,7 @@ 'use strict'; angular.module('copayApp.controllers').controller('SigninController', - function($scope, $rootScope, $location, walletFactory, controllerUtils, Passphrase) { + function($scope, $rootScope, $location, walletFactory, controllerUtils, Passphrase, backupService, notification) { var cmp = function(o1, o2) { var v1 = o1.show.toLowerCase(), v2 = o2.show.toLowerCase(); diff --git a/test/unit/controllers/controllersSpec.js b/test/unit/controllers/controllersSpec.js index b76b4488c..bd24badb9 100644 --- a/test/unit/controllers/controllersSpec.js +++ b/test/unit/controllers/controllersSpec.js @@ -12,6 +12,9 @@ saveAs = function(o) { describe("Unit: Controllers", function() { + var invalidForm = { + $invalid: true + }; var scope; @@ -75,10 +78,7 @@ describe("Unit: Controllers", function() { }); describe('#create', function() { it('should work with invalid form', function() { - var form = { - $invalid: true - }; - scope.create(form); + scope.create(invalidForm); }); }); @@ -321,7 +321,30 @@ describe("Unit: Controllers", function() { it('should exist', function() { should.exist(what); }); + }); + describe('Signin Controller', function() { + var what; + beforeEach(inject(function($controller, $rootScope) { + scope = $rootScope.$new(); + what = $controller('SigninController', { + $scope: scope, + }); + })); + + it('should exist', function() { + should.exist(what); + }); + describe('#open', function() { + it('should work with invalid form', function() { + scope.open(invalidForm); + }); + }); + describe('#join', function() { + it('should work with invalid form', function() { + scope.join(invalidForm); + }); + }); }); });