abavalidator
Version:
A validation module for browsers and Node.js to validate an American Bankers Association Routing Number used in ACH payments.
39 lines (29 loc) • 1.1 kB
JavaScript
;
require("mocha");
require("should");
// eslint-disable-next-line @typescript-eslint/no-var-requires
const aba = require("../dist/aba-validation")
, _VALID_ROUTING_NUMBER = "123123123";
describe("ABA Validation", function(){
describe("Basic Requirements", function(){
it("should only allow a 9 character routing number string", function(){
aba.validate(_VALID_ROUTING_NUMBER).should.be.true;
aba.validate("123123").should.be.false;
aba.validate("123123123123").should.be.false;
});
it("should trim the routing number", function(){
aba.validate(_VALID_ROUTING_NUMBER + " ").should.be.true;
});
it("should only allow numeric routing number strings", function(){
aba.validate(_VALID_ROUTING_NUMBER + "A").should.be.false;
});
it("should not allow a routing number that contains just 0's", function(){
aba.validate("000000000").should.be.false;
});
});
describe("Happy Path", function(){
it("should return true for valid routing numbers.", function(){
aba.validate(_VALID_ROUTING_NUMBER).should.be.true;
});
});
});