From 4db0a28df08bb97d6dfd149a6ff5a2e3882c41ef Mon Sep 17 00:00:00 2001 From: Mario Colque Date: Wed, 23 Apr 2014 12:59:21 -0300 Subject: [PATCH 1/4] moved bitcore into angular controller --- js/controllers/transactions.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/js/controllers/transactions.js b/js/controllers/transactions.js index 7cc47598e..c47efd739 100644 --- a/js/controllers/transactions.js +++ b/js/controllers/transactions.js @@ -1,8 +1,9 @@ 'use strict'; -var bitcore = require('bitcore'); angular.module('copay.transactions').controller('TransactionsController', function($scope, $rootScope, $location) { + var bitcore = require('bitcore'); + $scope.title = 'Transactions'; var _updateTxs = function() { var w =$rootScope.wallet; From 481a22e6f2a35847946a66d18860e0472ed9e9a8 Mon Sep 17 00:00:00 2001 From: Mario Colque Date: Wed, 23 Apr 2014 13:17:26 -0300 Subject: [PATCH 2/4] packages updated --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 455bddab1..48fd8ba26 100644 --- a/package.json +++ b/package.json @@ -25,8 +25,8 @@ "grunt-shell": "~0.6.4", "grunt-browserify": "~2.0.0", "grunt-markdown": "~0.5.0", - "karma": "~0.12.1", - "karma-chrome-launcher": "~0.1.2", + "karma": "~0.12.9", + "karma-chrome-launcher": "~0.1.3", "mocha": "~1.18.2", "karma-mocha": "~0.1.3", "buffertools": "~2.0.1", From e08acbd8634cc40ed3791f4e23d4615c47c8cc7d Mon Sep 17 00:00:00 2001 From: Mario Colque Date: Wed, 23 Apr 2014 13:17:52 -0300 Subject: [PATCH 3/4] added copay var --- js/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/app.js b/js/app.js index 1b6ef9813..24c39d302 100644 --- a/js/app.js +++ b/js/app.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copay',[ +var copay = window.copay = angular.module('copay',[ 'ngRoute', 'mm.foundation', 'monospaced.qrcode', From 178dfec1a84e00be144d37fe4cb3dde0c52f21a4 Mon Sep 17 00:00:00 2001 From: Mario Colque Date: Wed, 23 Apr 2014 13:21:33 -0300 Subject: [PATCH 4/4] added angularjs test configs --- karma.conf.js | 30 ++++++++++++++++---- test/lib/chai-expect.js | 1 + test/lib/chai-should.js | 1 + test/mocha.conf.js | 1 + test/unit/controllers/controllersSpec.js | 36 ++++++++++++++++++++++++ test/unit/directives/directivesSpec.js | 6 ++++ test/unit/filters/filtersSpec.js | 6 ++++ test/unit/services/servicesSpec.js | 6 ++++ 8 files changed, 81 insertions(+), 6 deletions(-) create mode 100644 test/lib/chai-expect.js create mode 100644 test/lib/chai-should.js create mode 100644 test/mocha.conf.js create mode 100644 test/unit/controllers/controllersSpec.js create mode 100644 test/unit/directives/directivesSpec.js create mode 100644 test/unit/filters/filtersSpec.js create mode 100644 test/unit/services/servicesSpec.js diff --git a/karma.conf.js b/karma.conf.js index 3de26ae16..add856c20 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -15,19 +15,34 @@ module.exports = function(config) { // list of files / patterns to load in the browser files: [ + //3rd Party Code 'lib/angular/angular.min.js', + 'lib/angular-route/angular-route.js', 'lib/angular-mocks/angular-mocks.js', - 'lib/chai/chai.js', + + //App-specific Code 'js/*.js', 'js/**/*.js', - 'test/test*.js', + + //Test-Specific Code + 'lib/chai/chai.js', + 'test/lib/chai-should.js', + 'test/lib/chai-expect.js', + + //Mocha stuff + 'test/mocha.conf.js', + + //test files + 'test/unit/**/*.js' ], // list of files to exclude exclude: [ - - ], + 'js/copayBundle.js', + 'js/models/**/*.js', + 'js/init.js' + ], // preprocess matching files before serving them to the browser @@ -62,11 +77,14 @@ module.exports = function(config) { // start these browsers // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher - browsers: [], + browsers: ['Chrome'], // Continuous Integration mode // if true, Karma captures browsers, runs the tests and exits - singleRun: false + singleRun: false, + + // if browser doesn't capture output in given timeout (ms), kill it + captureTimeout: 60000 }); }; diff --git a/test/lib/chai-expect.js b/test/lib/chai-expect.js new file mode 100644 index 000000000..35da61515 --- /dev/null +++ b/test/lib/chai-expect.js @@ -0,0 +1 @@ +var expect = chai.expect; diff --git a/test/lib/chai-should.js b/test/lib/chai-should.js new file mode 100644 index 000000000..71dd9f322 --- /dev/null +++ b/test/lib/chai-should.js @@ -0,0 +1 @@ +var should = chai.should(); diff --git a/test/mocha.conf.js b/test/mocha.conf.js new file mode 100644 index 000000000..fd1766e7c --- /dev/null +++ b/test/mocha.conf.js @@ -0,0 +1 @@ +window.mocha.setup({ timeout: 5000 }); diff --git a/test/unit/controllers/controllersSpec.js b/test/unit/controllers/controllersSpec.js new file mode 100644 index 000000000..a5190f5b7 --- /dev/null +++ b/test/unit/controllers/controllersSpec.js @@ -0,0 +1,36 @@ +// +// test/unit/controllers/controllersSpec.js +// +describe("Unit: Testing Controllers", function() { + + beforeEach(angular.mock.module('copay')); + + it('should have a AddressesController controller', function() { + expect(copay.AddressesController).not.to.equal(null); + }); + + it('should have a BackupController controller', function() { + expect(copay.Backupcontroller).not.to.equal(null); + }); + + it('should have a HeaderController controller', function() { + expect(copay.HeaderController).not.to.equal(null); + }); + + it('should have a SendController controller', function() { + expect(copay.SendController).not.to.equal(null); + }); + + it('should have a SetupController controller', function() { + expect(copay.SetupController).not.to.equal(null); + }); + + it('should have a SigninController controller', function() { + expect(copay.SigninController).not.to.equal(null); + }); + + it('should have a TransactionsController controller', function() { + expect(copay.TransactionsController).not.to.equal(null); + }); + +}); diff --git a/test/unit/directives/directivesSpec.js b/test/unit/directives/directivesSpec.js new file mode 100644 index 000000000..ca9c694ec --- /dev/null +++ b/test/unit/directives/directivesSpec.js @@ -0,0 +1,6 @@ +// +// test/unit/directives/directivesSpec.js +// +describe("Unit: Testing Directives", function() { + +}); diff --git a/test/unit/filters/filtersSpec.js b/test/unit/filters/filtersSpec.js new file mode 100644 index 000000000..c72b3fa07 --- /dev/null +++ b/test/unit/filters/filtersSpec.js @@ -0,0 +1,6 @@ +// +// test/unit/filters/filtersSpec.js +// +describe("Unit: Testing Filters", function() { + +}); diff --git a/test/unit/services/servicesSpec.js b/test/unit/services/servicesSpec.js new file mode 100644 index 000000000..2cfd1fda8 --- /dev/null +++ b/test/unit/services/servicesSpec.js @@ -0,0 +1,6 @@ +// +// test/unit/services/servicesSpec.js +// +describe("Unit: Testing Services", function() { + +});