Skip to content

Commit

Permalink
integer validations
Browse files Browse the repository at this point in the history
  • Loading branch information
diegoefe committed Dec 12, 2016
1 parent 7e42d87 commit 77c28b4
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -325,4 +325,18 @@ describe("datatype validation", function(){
expect(d('32/3/1969')).to.not.be.ok();
expect(d('30/3/0969')).to.not.be.ok();
});
it("integer", function(){
var i = txtToSql.typeValidations['integer'].checkOne;
// good
expect(i('1')).to.be.ok();
expect(i('1323')).to.be.ok();
expect(i('12345')).to.be.ok();
expect(i('0')).to.be.ok();
expect(i('-1')).to.be.ok();
// bad
expect(i('123456')).to.not.be.ok();
expect(i('1.1')).to.not.be.ok();
expect(i('.1')).to.not.be.ok();
expect(i('0.1')).to.not.be.ok();
});
});

0 comments on commit 77c28b4

Please sign in to comment.