mirror of https://github.com/BTCPrivate/copay.git
Tests for different amounts.
This commit is contained in:
parent
a76de35bb0
commit
d746110f96
|
@ -35,7 +35,7 @@ describe("Unit: Testing Directives", function() {
|
||||||
describe('Validate Amount', function() {
|
describe('Validate Amount', function() {
|
||||||
beforeEach(inject(function($compile, $rootScope) {
|
beforeEach(inject(function($compile, $rootScope) {
|
||||||
$scope = $rootScope;
|
$scope = $rootScope;
|
||||||
$rootScope.availableBalance = 2;
|
$rootScope.availableBalance = 0.101;
|
||||||
var element = angular.element(
|
var element = angular.element(
|
||||||
'<form name="form">' +
|
'<form name="form">' +
|
||||||
'<input type="number" id="amount" name="amount" placeholder="Amount" ng-model="amount" min="0.0001" max="10000000" enough-amount required>' +
|
'<input type="number" id="amount" name="amount" placeholder="Amount" ng-model="amount" min="0.0001" max="10000000" enough-amount required>' +
|
||||||
|
@ -47,19 +47,21 @@ describe("Unit: Testing Directives", function() {
|
||||||
form = $scope.form;
|
form = $scope.form;
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should validate between min and max value', function() {
|
it('should validate', function() {
|
||||||
form.amount.$setViewValue(1.2);
|
form.amount.$setViewValue(0.1);
|
||||||
|
expect(form.amount.$invalid).to.equal(false);
|
||||||
|
form.amount.$setViewValue(0.1009);
|
||||||
expect(form.amount.$invalid).to.equal(false);
|
expect(form.amount.$invalid).to.equal(false);
|
||||||
});
|
});
|
||||||
it('should not validate between min and max value', function() {
|
it('should not validate', function() {
|
||||||
form.amount.$setViewValue(0);
|
form.amount.$setViewValue(0);
|
||||||
expect(form.amount.$invalid).to.equal(true);
|
expect(form.amount.$invalid).to.equal(true);
|
||||||
form.amount.$setViewValue(9999999999999);
|
form.amount.$setViewValue(9999999999);
|
||||||
expect(form.amount.$invalid).to.equal(true);
|
expect(form.amount.$invalid).to.equal(true);
|
||||||
});
|
|
||||||
it('should not validate because not enough amount', function() {
|
|
||||||
form.amount.$setViewValue(2.1);
|
form.amount.$setViewValue(2.1);
|
||||||
expect(form.amount.$invalid).to.equal(true);
|
expect(form.amount.$invalid).to.equal(true);
|
||||||
|
form.amount.$setViewValue(0.10091);
|
||||||
|
expect(form.amount.$invalid).to.equal(true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue