fixed karma test bug
This commit is contained in:
parent
d800a98df0
commit
0c03af53a8
8 changed files with 44 additions and 30 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copayApp.controllers').controller('HeaderController',
|
angular.module('copayApp.controllers').controller('HeaderController',
|
||||||
function($scope, $rootScope, $location, $notification, $http, controllerUtils) {
|
function($scope, $rootScope, $location, notification, $http, controllerUtils) {
|
||||||
$scope.menu = [
|
$scope.menu = [
|
||||||
{
|
{
|
||||||
'title': 'Addresses',
|
'title': 'Addresses',
|
||||||
|
|
@ -64,7 +64,7 @@ angular.module('copayApp.controllers').controller('HeaderController',
|
||||||
}
|
}
|
||||||
if (currentAddr) {
|
if (currentAddr) {
|
||||||
//var beep = new Audio('sound/transaction.mp3');
|
//var beep = new Audio('sound/transaction.mp3');
|
||||||
$notification.funds('Received fund', currentAddr, receivedFund);
|
notification.funds('Received fund', currentAddr, receivedFund);
|
||||||
//beep.play();
|
//beep.play();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -72,7 +72,7 @@ angular.module('copayApp.controllers').controller('HeaderController',
|
||||||
|
|
||||||
$rootScope.$watch('txAlertCount', function(txAlertCount) {
|
$rootScope.$watch('txAlertCount', function(txAlertCount) {
|
||||||
if (txAlertCount && txAlertCount > 0) {
|
if (txAlertCount && txAlertCount > 0) {
|
||||||
$notification.info('New Transaction', ($rootScope.txAlertCount == 1) ? 'You have a pending transaction proposal' : 'You have ' + $rootScope.txAlertCount + ' pending transaction proposals', txAlertCount);
|
notification.info('New Transaction', ($rootScope.txAlertCount == 1) ? 'You have a pending transaction proposal' : 'You have ' + $rootScope.txAlertCount + ' pending transaction proposals', txAlertCount);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var BackupService = function($notification) {
|
|
||||||
this.notifications = $notification;
|
var BackupService = function(notification) {
|
||||||
|
this.notifications = notification;
|
||||||
};
|
};
|
||||||
|
|
||||||
BackupService.prototype.getName = function(wallet) {
|
BackupService.prototype.getName = function(wallet) {
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
var bitcore = require('bitcore');
|
var bitcore = require('bitcore');
|
||||||
|
|
||||||
angular.module('copayApp.services')
|
angular.module('copayApp.services')
|
||||||
.factory('controllerUtils', function($rootScope, $sce, $location, $notification, $timeout, Socket, video) {
|
.factory('controllerUtils', function($rootScope, $sce, $location, notification, $timeout, Socket, video) {
|
||||||
var root = {};
|
var root = {};
|
||||||
|
|
||||||
root.getVideoMutedStatus = function(copayer) {
|
root.getVideoMutedStatus = function(copayer) {
|
||||||
|
|
@ -87,7 +87,7 @@ angular.module('copayApp.services')
|
||||||
$rootScope.$digest();
|
$rootScope.$digest();
|
||||||
};
|
};
|
||||||
|
|
||||||
$notification.enableHtml5Mode(); // for chrome: if support, enable it
|
notification.enableHtml5Mode(); // for chrome: if support, enable it
|
||||||
|
|
||||||
w.on('badMessage', function(peerId) {
|
w.on('badMessage', function(peerId) {
|
||||||
$rootScope.$flashMessage = {
|
$rootScope.$flashMessage = {
|
||||||
|
|
@ -126,11 +126,11 @@ angular.module('copayApp.services')
|
||||||
switch (e.type) {
|
switch (e.type) {
|
||||||
case 'signed':
|
case 'signed':
|
||||||
var user = w.publicKeyRing.nicknameForCopayer(e.cId);
|
var user = w.publicKeyRing.nicknameForCopayer(e.cId);
|
||||||
$notification.info('Transaction Update', 'A transaction was signed by ' + user);
|
notification.info('Transaction Update', 'A transaction was signed by ' + user);
|
||||||
break;
|
break;
|
||||||
case 'rejected':
|
case 'rejected':
|
||||||
var user = w.publicKeyRing.nicknameForCopayer(e.cId);
|
var user = w.publicKeyRing.nicknameForCopayer(e.cId);
|
||||||
$notification.info('Transaction Update', 'A transaction was rejected by ' + user);
|
notification.info('Transaction Update', 'A transaction was rejected by ' + user);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copayApp.services').
|
angular.module('copayApp.services').
|
||||||
factory('$notification', ['$timeout',function($timeout){
|
factory('notification', ['$timeout',function($timeout){
|
||||||
|
|
||||||
var notifications = JSON.parse(localStorage.getItem('$notifications')) || [],
|
var notifications = JSON.parse(localStorage.getItem('notifications')) || [],
|
||||||
queue = [];
|
queue = [];
|
||||||
|
|
||||||
var settings = {
|
var settings = {
|
||||||
|
|
@ -186,7 +186,7 @@ angular.module('copayApp.services').
|
||||||
save: function(){
|
save: function(){
|
||||||
// Save all the notifications into localStorage
|
// Save all the notifications into localStorage
|
||||||
if(settings.localStorage){
|
if(settings.localStorage){
|
||||||
localStorage.setItem('$notifications', JSON.stringify(notifications));
|
localStorage.setItem('notifications', JSON.stringify(notifications));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -201,7 +201,7 @@ angular.module('copayApp.services').
|
||||||
|
|
||||||
};
|
};
|
||||||
}]).
|
}]).
|
||||||
directive('notifications', ['$notification', '$compile', function($notification, $compile){
|
directive('notifications', function(notification, $compile){
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* It should also parse the arguments passed to it that specify
|
* It should also parse the arguments passed to it that specify
|
||||||
|
|
@ -245,7 +245,7 @@ angular.module('copayApp.services').
|
||||||
template: html,
|
template: html,
|
||||||
link: link,
|
link: link,
|
||||||
controller: ['$scope', function NotificationsCtrl( $scope ){
|
controller: ['$scope', function NotificationsCtrl( $scope ){
|
||||||
$scope.queue = $notification.getQueue();
|
$scope.queue = notification.getQueue();
|
||||||
|
|
||||||
$scope.removeNotification = function(noti){
|
$scope.removeNotification = function(noti){
|
||||||
$scope.queue.splice($scope.queue.indexOf(noti), 1);
|
$scope.queue.splice($scope.queue.indexOf(noti), 1);
|
||||||
|
|
@ -254,4 +254,9 @@ angular.module('copayApp.services').
|
||||||
]
|
]
|
||||||
|
|
||||||
};
|
};
|
||||||
}]);
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,9 @@ var Video = function() {
|
||||||
|
|
||||||
this.mediaConnections = {};
|
this.mediaConnections = {};
|
||||||
this.localStream = null;
|
this.localStream = null;
|
||||||
this.onlineSound = new Audio('sound/online.wav');
|
if (typeof Audio !== 'undefined') {
|
||||||
|
this.onlineSound = new Audio('sound/online.wav');
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Video.prototype.setOwnPeer = function(peer, wallet, cb) {
|
Video.prototype.setOwnPeer = function(peer, wallet, cb) {
|
||||||
|
|
@ -64,7 +66,7 @@ Video.prototype._addCall = function(mediaConnection, cb) {
|
||||||
|
|
||||||
// Wait for stream on the call, then set peer video display
|
// Wait for stream on the call, then set peer video display
|
||||||
mediaConnection.on('stream', function(stream) {
|
mediaConnection.on('stream', function(stream) {
|
||||||
self.onlineSound.play();
|
if (self.onlineSound) self.onlineSound.play();
|
||||||
cb(null, peerID, URL.createObjectURL(stream));
|
cb(null, peerID, URL.createObjectURL(stream));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,15 +39,6 @@ module.exports = function(config) {
|
||||||
'lib/qrcode-decoder-js/lib/qrcode-decoder.min.js',
|
'lib/qrcode-decoder-js/lib/qrcode-decoder.min.js',
|
||||||
'js/copayBundle.js',
|
'js/copayBundle.js',
|
||||||
|
|
||||||
//Test-Specific Code
|
|
||||||
'lib/chai/chai.js',
|
|
||||||
'test/lib/chai-should.js',
|
|
||||||
'test/lib/chai-expect.js',
|
|
||||||
'test/mocks/FakeWallet.js',
|
|
||||||
|
|
||||||
//Mocha stuff
|
|
||||||
'test/mocha.conf.js',
|
|
||||||
|
|
||||||
//App-specific Code
|
//App-specific Code
|
||||||
'js/app.js',
|
'js/app.js',
|
||||||
'js/routes.js',
|
'js/routes.js',
|
||||||
|
|
@ -57,6 +48,13 @@ module.exports = function(config) {
|
||||||
'js/controllers/*.js',
|
'js/controllers/*.js',
|
||||||
'js/init.js',
|
'js/init.js',
|
||||||
|
|
||||||
|
//Test-Specific Code
|
||||||
|
'lib/chai/chai.js',
|
||||||
|
'test/lib/chai-should.js',
|
||||||
|
'test/lib/chai-expect.js',
|
||||||
|
'test/mocks/FakeWallet.js',
|
||||||
|
|
||||||
|
'test/mocha.conf.js',
|
||||||
|
|
||||||
//test files
|
//test files
|
||||||
'test/unit/**/*.js'
|
'test/unit/**/*.js'
|
||||||
|
|
|
||||||
|
|
@ -34,9 +34,11 @@
|
||||||
"browserify": "3.32.1",
|
"browserify": "3.32.1",
|
||||||
"buffertools": "2.0.1",
|
"buffertools": "2.0.1",
|
||||||
"chai": "1.9.1",
|
"chai": "1.9.1",
|
||||||
|
"cli-color": "0.3.2",
|
||||||
"commander": "2.1.0",
|
"commander": "2.1.0",
|
||||||
"coveralls": "2.10.0",
|
"coveralls": "2.10.0",
|
||||||
"express": "4.0.0",
|
"express": "4.0.0",
|
||||||
|
"github-releases": "0.2.0",
|
||||||
"grunt-browserify": "2.0.8",
|
"grunt-browserify": "2.0.8",
|
||||||
"grunt-contrib-watch": "0.5.3",
|
"grunt-contrib-watch": "0.5.3",
|
||||||
"grunt-markdown": "0.5.0",
|
"grunt-markdown": "0.5.0",
|
||||||
|
|
@ -46,15 +48,14 @@
|
||||||
"karma": "0.12.9",
|
"karma": "0.12.9",
|
||||||
"karma-chrome-launcher": "0.1.3",
|
"karma-chrome-launcher": "0.1.3",
|
||||||
"karma-mocha": "0.1.3",
|
"karma-mocha": "0.1.3",
|
||||||
|
"karma-phantomjs-launcher": "^0.1.4",
|
||||||
"mocha": "1.18.2",
|
"mocha": "1.18.2",
|
||||||
"mocha-lcov-reporter": "0.0.1",
|
"mocha-lcov-reporter": "0.0.1",
|
||||||
"node-cryptojs-aes": "0.4.0",
|
"node-cryptojs-aes": "0.4.0",
|
||||||
"sinon": "1.9.1",
|
"sinon": "1.9.1",
|
||||||
"soop": "0.1.5",
|
"soop": "0.1.5",
|
||||||
"travis-cov": "0.2.5",
|
"travis-cov": "0.2.5",
|
||||||
"uglifyify": "1.2.3",
|
"uglifyify": "1.2.3"
|
||||||
"github-releases": "0.2.0",
|
|
||||||
"cli-color": "0.3.2"
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"mocha": "^1.18.2",
|
"mocha": "^1.18.2",
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,8 @@
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
var sinon = require('sinon');
|
||||||
|
|
||||||
describe('Check config', function() {
|
describe('Check config', function() {
|
||||||
it('unit should be set to BITS in config.js', function() {
|
it('unit should be set to BITS in config.js', function() {
|
||||||
expect(config.unitToSatoshi).to.equal(100);
|
expect(config.unitToSatoshi).to.equal(100);
|
||||||
|
|
@ -87,9 +89,14 @@ describe("Unit: controllerUtils", function() {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe("Unit: Notification Service", function() {
|
||||||
|
beforeEach(angular.mock.module('copayApp.services'));
|
||||||
|
it('should contain a notification service', inject(function(notification) {
|
||||||
|
expect(notification).not.to.equal(null);
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
|
||||||
describe("Unit: Backup Service", function() {
|
describe("Unit: Backup Service", function() {
|
||||||
var sinon = require('sinon');
|
|
||||||
beforeEach(angular.mock.module('copayApp.services'));
|
beforeEach(angular.mock.module('copayApp.services'));
|
||||||
it('should contain a backup service', inject(function(backupService) {
|
it('should contain a backup service', inject(function(backupService) {
|
||||||
expect(backupService).not.to.equal(null);
|
expect(backupService).not.to.equal(null);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue