diff --git a/karma.conf.js b/karma.conf.js index a194c5a3a..0390efd96 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -71,14 +71,19 @@ module.exports = function(config) { // preprocess matching files before serving them to the browser // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor preprocessors: { + 'js/controllers/*.js': ['coverage'] + }, + coverageReporter: { + type: 'html', + dir: 'coverage/' }, // test results reporter to use // possible values: 'dots', 'progress' // available reporters: https://npmjs.org/browse/keyword/karma-reporter - reporters: ['progress'], + reporters: ['progress', 'coverage'], // web server port diff --git a/test/unit/controllers/controllersSpec.js b/test/unit/controllers/controllersSpec.js index ca9436c26..f544910c3 100644 --- a/test/unit/controllers/controllersSpec.js +++ b/test/unit/controllers/controllersSpec.js @@ -112,6 +112,8 @@ describe("Unit: Controllers", function() { iden.getWalletById = sinon.stub().returns(w); iden.getName = sinon.stub().returns('name'); iden.deleteWallet = sinon.stub(); + iden.close = sinon.stub().returns(null); + $rootScope.wallet = w; $rootScope.iden = iden; @@ -479,7 +481,7 @@ describe("Unit: Controllers", function() { }); - describe.skip("Unit: Sidebar Controller", function() { + describe("Unit: Sidebar Controller", function() { beforeEach(inject(function($controller, $rootScope) { rootScope = $rootScope; scope = $rootScope.$new(); @@ -488,10 +490,10 @@ describe("Unit: Controllers", function() { }); })); - it('should return an array of n undefined elements', function() { - var n = 5; - var array = scope.getNumber(n); - expect(array.length).equal(n); + it.only('should call sign out', function() { + + scope.signout(); + rootScope.iden.close.calledOnce.should.be.true; }); }); @@ -568,6 +570,20 @@ describe("Unit: Controllers", function() { }); }); + describe.only('SignOut Controller', function() { + var what; + beforeEach(inject(function($controller, $rootScope) { + scope = $rootScope.$new(); + what = $controller('signOutController', { + $scope: scope, + }); + })); + + it('should exist', function() { + should.exist(what); + }); + }); + describe('Settings Controller', function() { var what; beforeEach(inject(function($controller, $rootScope) {