uk-modulus-checking
Advanced tools
Comparing version 0.0.2 to 0.0.3
# Changelog | ||
## [0.0.2](https://github.com/uphold/uk-modulus-checking/tree/0.0.2) | ||
## [0.0.3](https://github.com/uphold/uk-modulus-checking/tree/HEAD) | ||
[Full Changelog](https://github.com/uphold/uk-modulus-checking/compare/0.0.2...HEAD) | ||
**Merged pull requests:** | ||
- Add accountNumber and sortCode length validation [\#7](https://github.com/uphold/uk-modulus-checking/pull/7) ([promag](https://github.com/promag)) | ||
## [0.0.2](https://github.com/uphold/uk-modulus-checking/tree/0.0.2) (2016-03-09) | ||
[Full Changelog](https://github.com/uphold/uk-modulus-checking/compare/0.0.1...0.0.2) | ||
@@ -6,0 +13,0 @@ |
@@ -280,2 +280,6 @@ 'use strict'; | ||
value: function isValid() { | ||
if (this.accountNumber.length < 6 || this.accountNumber.length > 10 || this.sortCode.length !== 6) { | ||
return false; | ||
} | ||
var checks = this.getSortCodeChecks(); | ||
@@ -282,0 +286,0 @@ |
{ | ||
"name": "uk-modulus-checking", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "Validate a UK bank account number against a sort code using the VocaLink modulus check", | ||
@@ -5,0 +5,0 @@ "author": "Uphold", |
@@ -202,2 +202,6 @@ | ||
isValid() { | ||
if (this.accountNumber.length < 6 || this.accountNumber.length > 10 || this.sortCode.length !== 6) { | ||
return false; | ||
} | ||
const checks = this.getSortCodeChecks(); | ||
@@ -204,0 +208,0 @@ |
@@ -55,2 +55,14 @@ | ||
describe('isValid()', () => { | ||
it('should return false if account number length is less than 6', () => { | ||
new UkModulusChecking({ accountNumber: '12345', sortCode: '123456' }).isValid().should.be.false(); | ||
}); | ||
it('should return false if account number length is greater than 10', () => { | ||
new UkModulusChecking({ accountNumber: '12345678901', sortCode: '123456' }).isValid().should.be.false(); | ||
}); | ||
it('should return false if sort code length is not 6', () => { | ||
new UkModulusChecking({ accountNumber: '12345789', sortCode: '12345' }).isValid().should.be.false(); | ||
}); | ||
accounts.invalid.forEach((account) => { | ||
@@ -57,0 +69,0 @@ it(`should return false if sort code is ${account.sortCode} and account number is ${account.accountNumber}`, () => { |
1578336
680