From 77b4c9cb9aed8de7b17434a7bd5f05676c93096c Mon Sep 17 00:00:00 2001 From: Cyril Schumacher Date: Fri, 30 Jan 2015 08:50:31 +0100 Subject: [PATCH] Add tests. Update definition. --- iban/iban-tests.ts | 53 ++++++++++++++++++++++++++++++++++++++++++ iban/iban.d.ts | 12 ++++++---- iban/iban.ts.tscparams | 1 + 3 files changed, 61 insertions(+), 5 deletions(-) create mode 100644 iban/iban-tests.ts create mode 100644 iban/iban.ts.tscparams diff --git a/iban/iban-tests.ts b/iban/iban-tests.ts new file mode 100644 index 000000000..f33faeebd --- /dev/null +++ b/iban/iban-tests.ts @@ -0,0 +1,53 @@ +/// + +/** + * @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); +} \ No newline at end of file diff --git a/iban/iban.d.ts b/iban/iban.d.ts index 55efdaa2a..b39f5908c 100644 --- a/iban/iban.d.ts +++ b/iban/iban.d.ts @@ -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. diff --git a/iban/iban.ts.tscparams b/iban/iban.ts.tscparams new file mode 100644 index 000000000..934bc29ef --- /dev/null +++ b/iban/iban.ts.tscparams @@ -0,0 +1 @@ +--noImplicitAny \ No newline at end of file