Remove unnused variable. Added tests to check amount validation
This commit is contained in:
parent
cf8670c64f
commit
6586a4b696
2 changed files with 23 additions and 6 deletions
|
|
@ -273,7 +273,7 @@ describe("Unit: Controllers", function() {
|
|||
var element2 = angular.element(
|
||||
'<form name="form2">' +
|
||||
'<input type="text" id="address" name="address" ng-model="_address" valid-address required>' +
|
||||
'<input type="number" id="amount" name="amount" ng-model="_amount" min="1" max="10000000000" required>' +
|
||||
'<input type="number" id="amount" name="amount" ng-model="_amount" min="0.00000001" max="10000000000" valid-amount required>' +
|
||||
'<input type="number" id="alternative" name="alternative" ng-model="_alternative">' +
|
||||
'<textarea id="comment" name="comment" ng-model="commentText" ng-maxlength="100"></textarea>' +
|
||||
'</form>'
|
||||
|
|
@ -390,6 +390,27 @@ describe("Unit: Controllers", function() {
|
|||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('receive from uri using bits', inject(function() {
|
||||
sendForm.address.$setViewValue('bitcoin:mxf5psDyA8EQVzb2MZ7MkDWiXuAuWWCRMB?amount=1.018085');
|
||||
expect(sendForm.amount.$modelValue).to.equal(1018085);
|
||||
sendForm.address.$setViewValue('bitcoin:mxf5psDyA8EQVzb2MZ7MkDWiXuAuWWCRMB?amount=1.01808500');
|
||||
expect(sendForm.amount.$modelValue).to.equal(1018085);
|
||||
sendForm.address.$setViewValue('bitcoin:mxf5psDyA8EQVzb2MZ7MkDWiXuAuWWCRMB?amount=0.29133585');
|
||||
expect(sendForm.amount.$modelValue).to.equal(291335.85);
|
||||
}));
|
||||
|
||||
it('receive from uri using BTC', inject(function($rootScope) {
|
||||
var old = $rootScope.wallet.settings.unitToSatoshi;
|
||||
$rootScope.wallet.settings.unitToSatoshi = 100000000;
|
||||
sendForm.address.$setViewValue('bitcoin:mxf5psDyA8EQVzb2MZ7MkDWiXuAuWWCRMB?amount=1.018085');
|
||||
expect(sendForm.amount.$modelValue).to.equal(1.018085);
|
||||
sendForm.address.$setViewValue('bitcoin:mxf5psDyA8EQVzb2MZ7MkDWiXuAuWWCRMB?amount=1.01808500');
|
||||
expect(sendForm.amount.$modelValue).to.equal(1.018085);
|
||||
sendForm.address.$setViewValue('bitcoin:mxf5psDyA8EQVzb2MZ7MkDWiXuAuWWCRMB?amount=0.29133585');
|
||||
expect(sendForm.amount.$modelValue).to.equal(0.29133585);
|
||||
$rootScope.wallet.settings.unitToSatoshi = old;
|
||||
}));
|
||||
});
|
||||
|
||||
describe("Unit: Version Controller", function() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue