Add tests.

Update definition.
This commit is contained in:
Cyril Schumacher
2015-01-30 08:50:31 +01:00
parent 367dd36c03
commit 77b4c9cb9a
3 changed files with 61 additions and 5 deletions
+53
View File
@@ -0,0 +1,53 @@
/// <reference path="iban.d.ts" />
/**
* @summary Test for "electronicFormat" method.
*/
function testElectronicFormat() {
var iban: string = 'BE68539007547034';
var format: string = IBAN.electronicFormat(iban);
}
/**
* @summary Test for "fromBBAN" method.
*/
function testFromBBAN() {
var countryCode: string = 'fr';
var bban: string = 'BBBBBGGGGGCCCCCCCCCCCKK';
var iban: string = IBAN.fromBBAN(countryCode, bban);
}
/**
* @summary Test for "isValid" method.
*/
function testIsValid() {
var iban: string = 'BE68539007547034';
var valid: boolean = IBAN.isValid(iban);
}
/**
* @summary Test for "isValidBBAN" method.
*/
function testIsValidBBAN() {
var countryCode: string = 'fr';
var bban: string = 'BBBBBGGGGGCCCCCCCCCCCKK';
var valid: boolean = IBAN.isValidBBAN(countryCode, bban);
}
/**
* @summary Test for "printFormat" method.
*/
function testPrintFormat() {
var iban: string = 'BE68539007547034';
var separator: string[] = ['fr'];
var format: string = IBAN.printFormat(iban, separator);
}
/**
* @summary Test for "toBBAN" method.
*/
function testToBBAN() {
var iban: string = 'BE68539007547034';
var separator: string[] = ['-'];
var bban: string = IBAN.toBBAN(iban, separator);
}
+7 -5
View File
@@ -19,10 +19,11 @@ declare module ARHS {
/**
* @summary Convert the passed BBAN to an IBAN for this country specification.
* @param {string} bban The BBAN to convert to IBAN
* @returns {string} The IBAN
* @param {string} countryCode The country of the BBAN.
* @param {string} bban The BBAN to convert to IBAN.
* @returns {string} The IBAN.
*/
fromBBAN(bban: string): string;
fromBBAN(countryCode: string, bban: string): string;
/**
* @summary Check if the passed iban is valid according to this specification.
@@ -33,10 +34,11 @@ declare module ARHS {
/**
* @summary Check of the passed BBAN is valid.
* @param {string} bban The BBAN to validate
* @param {string} countryCode The country of the BBAN.
* @param {string} bban The BBAN to validate.
* @returns {boolean} True if valid, false otherwise.
*/
isValidBBAN(bban: string): boolean;
isValidBBAN(countryCode: string, bban: string): boolean;
/**
* @summary Returns the IBAN in a print format.
+1
View File
@@ -0,0 +1 @@
--noImplicitAny