From 8517dcd2d6148821f07430498cdadc96a1756ea5 Mon Sep 17 00:00:00 2001 From: Ivan Socolsky Date: Tue, 4 Nov 2014 16:01:45 -0300 Subject: [PATCH] cleanup unused method for alt currency conversion --- js/controllers/history.js | 10 +--------- test/unit/controllers/controllersSpec.js | 23 ++++++----------------- 2 files changed, 7 insertions(+), 26 deletions(-) diff --git a/js/controllers/history.js b/js/controllers/history.js index b7331b7ad..01868c399 100644 --- a/js/controllers/history.js +++ b/js/controllers/history.js @@ -59,7 +59,7 @@ angular.module('copayApp.controllers').controller('HistoryController', return; } - _.each(res, function (r) { + _.each(res, function(r) { r.ts = r.minedTs || r.sentTs; if (r.action === 'sent' && r.peerActions) { r.actionList = controllerUtils.getActionList(r.peerActions); @@ -82,14 +82,6 @@ angular.module('copayApp.controllers').controller('HistoryController', var w = $rootScope.wallet; return w.getNetworkName().substring(0, 4); }; - $scope.amountAlternative = function(amount, txIndex, cb) { - var w = $rootScope.wallet; - rateService.whenAvailable(function() { - var valueSat = amount * w.settings.unitToSatoshi; - $scope.alternativeCurrency[txIndex] = rateService.toFiat(valueSat, w.settings.alternativeIsoCode); - return cb ? cb() : null; - }); - }; // Autoload transactions $scope.getTransactions(); diff --git a/test/unit/controllers/controllersSpec.js b/test/unit/controllers/controllersSpec.js index dfc539e55..13a990411 100644 --- a/test/unit/controllers/controllersSpec.js +++ b/test/unit/controllers/controllersSpec.js @@ -26,11 +26,11 @@ describe("Unit: Controllers", function() { var server; beforeEach(module('copayApp')); - beforeEach(module('copayApp.controllers')); - beforeEach(module(function($provide) { - $provide.value('request', { - 'get': function(_, cb) { - cb(null, null, [{ + beforeEach(module('copayApp.controllers')); + beforeEach(module(function($provide) { + $provide.value('request', { + 'get': function(_, cb) { + cb(null, null, [{ name: 'USD Dollars', code: 'USD', rate: 2 @@ -71,7 +71,7 @@ describe("Unit: Controllers", function() { w.createTx = sinon.stub().yields(null); w.sendTx = sinon.stub().yields(null); w.requiresMultipleSignatures = sinon.stub().returns(true); - w.getTxProposals = sinon.stub().returns([1,2,3]); + w.getTxProposals = sinon.stub().returns([1, 2, 3]); $rootScope.wallet = w; @@ -172,17 +172,6 @@ describe("Unit: Controllers", function() { scope.getTransactions(); expect(scope.blockchain_txs).to.be.empty; }); - - it('should call amountAlternative and return a value', function() { - var cb = sinon.spy(); - var s1 = sinon.stub(scope, 'amountAlternative'); - s1.onCall(0).returns(1000); - s1.onCall(1).returns(2000); - expect(s1(100, 0, cb)).equal(1000); - expect(s1(200, 1, cb)).equal(2000); - sinon.assert.callCount(scope.amountAlternative, 2); - s1.restore(); - }); }); describe('Send Controller', function() {