simple test
This commit is contained in:
parent
8ef737083a
commit
26148d1f76
2 changed files with 17 additions and 1 deletions
|
|
@ -156,11 +156,12 @@ angular.module('copayApp.controllers').controller('TransactionsController',
|
||||||
$scope.getTransactions();
|
$scope.getTransactions();
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.amountAlternative = function (amount, txIndex) {
|
$scope.amountAlternative = function (amount, txIndex, cb) {
|
||||||
var w = $rootScope.wallet;
|
var w = $rootScope.wallet;
|
||||||
rateService.whenAvailable(function() {
|
rateService.whenAvailable(function() {
|
||||||
var valueSat = amount * w.settings.unitToSatoshi;
|
var valueSat = amount * w.settings.unitToSatoshi;
|
||||||
$scope.alternativeCurrency[txIndex] = rateService.toFiat(valueSat, w.settings.alternativeIsoCode);
|
$scope.alternativeCurrency[txIndex] = rateService.toFiat(valueSat, w.settings.alternativeIsoCode);
|
||||||
|
return cb ? cb() : null;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -127,6 +127,10 @@ describe("Unit: Controllers", function() {
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
it('should exist', function() {
|
||||||
|
should.exist(transactionsCtrl);
|
||||||
|
});
|
||||||
|
|
||||||
it('should have a TransactionController controller', function() {
|
it('should have a TransactionController controller', function() {
|
||||||
expect(scope.loading).equal(false);
|
expect(scope.loading).equal(false);
|
||||||
});
|
});
|
||||||
|
|
@ -135,6 +139,17 @@ describe("Unit: Controllers", function() {
|
||||||
scope.getTransactions();
|
scope.getTransactions();
|
||||||
expect(scope.blockchain_txs).to.be.empty;
|
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() {
|
describe('Send Controller', function() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue