From d746110f960da6e3ff43d86a4a706a9bf033a704 Mon Sep 17 00:00:00 2001 From: Gustavo Cortez Date: Thu, 12 Jun 2014 11:12:59 -0300 Subject: [PATCH] Tests for different amounts. --- test/unit/directives/directivesSpec.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/test/unit/directives/directivesSpec.js b/test/unit/directives/directivesSpec.js index 4f3b76d82..4cc8912f1 100644 --- a/test/unit/directives/directivesSpec.js +++ b/test/unit/directives/directivesSpec.js @@ -35,7 +35,7 @@ describe("Unit: Testing Directives", function() { describe('Validate Amount', function() { beforeEach(inject(function($compile, $rootScope) { $scope = $rootScope; - $rootScope.availableBalance = 2; + $rootScope.availableBalance = 0.101; var element = angular.element( '
' + '' + @@ -47,19 +47,21 @@ describe("Unit: Testing Directives", function() { form = $scope.form; })); - it('should validate between min and max value', function() { - form.amount.$setViewValue(1.2); + it('should validate', function() { + form.amount.$setViewValue(0.1); + expect(form.amount.$invalid).to.equal(false); + form.amount.$setViewValue(0.1009); 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); expect(form.amount.$invalid).to.equal(true); - form.amount.$setViewValue(9999999999999); + form.amount.$setViewValue(9999999999); expect(form.amount.$invalid).to.equal(true); - }); - it('should not validate because not enough amount', function() { form.amount.$setViewValue(2.1); expect(form.amount.$invalid).to.equal(true); + form.amount.$setViewValue(0.10091); + expect(form.amount.$invalid).to.equal(true); }); });