-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(core): fix for validation module related to requested changes
- Loading branch information
Showing
29 changed files
with
70 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
"use strict"; | ||
|
||
export * from "./is-bban"; | ||
export * from "./is-bic"; | ||
export * from "./is-company-number"; | ||
export * from "./is-establishment-unit-number"; | ||
export * from "./is-iban"; | ||
export * from "./is-isin"; | ||
export * from "./is-kbo"; | ||
export * from "./is-nin"; | ||
export * from "./is-supported-language"; | ||
export * from "./map-is-valid"; | ||
export * from "./map-not-empty"; | ||
export * from "./is-bban/index"; | ||
export * from "./is-bic/index"; | ||
export * from "./is-company-number/index"; | ||
export * from "./is-establishment-unit-number/index"; | ||
export * from "./is-iban/index"; | ||
export * from "./is-isin/index"; | ||
export * from "./is-kbo/index"; | ||
export * from "./is-nin/index"; | ||
export * from "./is-supported-language/index"; | ||
export * from "./map-is-valid/index"; | ||
export * from "./map-not-empty/index"; |
2 changes: 1 addition & 1 deletion
2
packages/stark-core/src/validation/decorators/is-bban/is-bban.validator.decorator.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/stark-core/src/validation/decorators/is-bic/is-bic.validator.decorator.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...src/validation/decorators/is-company-number/is-company-number.validator.decorator.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ors/is-establishment-unit-number/is-establishment-unit-number.validator.decorator.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/stark-core/src/validation/decorators/is-isin/is-isin.validator.decorator.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/stark-core/src/validation/decorators/is-kbo/is-kbo.validator.decorator.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/stark-core/src/validation/decorators/is-nin/is-nin.validator.decorator.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...rk-core/src/validation/decorators/map-not-empty/map-not-empty.validator.decorator.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
"use strict"; | ||
|
||
export * from "./decorators"; | ||
export * from "./validators"; | ||
export * from "./decorators/index"; | ||
export * from "./validators/index"; | ||
|
||
export * from "./validator"; | ||
export * from "./validator.intf"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
"use strict"; | ||
|
||
import { Validator } from "class-validator"; | ||
|
||
export interface StarkValidator extends Validator { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
"use strict"; | ||
|
||
export * from "./array-size-range"; | ||
export * from "./is-bban"; | ||
export * from "./is-bic"; | ||
export * from "./is-company-number"; | ||
export * from "./is-date-time"; | ||
export * from "./is-establishment-unit-number"; | ||
export * from "./is-iban"; | ||
export * from "./is-isin"; | ||
export * from "./is-kbo"; | ||
export * from "./is-nin"; | ||
export * from "./is-supported-language"; | ||
export * from "./map-not-empty"; | ||
export * from "./array-size-range/index"; | ||
export * from "./is-bban/index"; | ||
export * from "./is-bic/index"; | ||
export * from "./is-company-number/index"; | ||
export * from "./is-date-time/index"; | ||
export * from "./is-establishment-unit-number/index"; | ||
export * from "./is-iban/index"; | ||
export * from "./is-isin/index"; | ||
export * from "./is-kbo/index"; | ||
export * from "./is-nin/index"; | ||
export * from "./is-supported-language/index"; | ||
export * from "./map-not-empty/index"; |
2 changes: 1 addition & 1 deletion
2
packages/stark-core/src/validation/validators/is-date-time/is-date-time.validator.fn.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
packages/stark-core/src/validation/validators/is-iban/is-iban.validator.fn.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
"use strict"; | ||
|
||
import { isValidIBAN, extractIBAN } from "ibantools"; | ||
import { isValidIBAN, electronicFormatIBAN } from "ibantools"; | ||
|
||
export const starkIsIBANValidatorName: string = "starkIsIBAN"; | ||
|
||
export function starkIsIBAN(iban: string): boolean { | ||
if (typeof iban === "string") { | ||
//Since v2.0.0 of ibantools, isValidIBAN() is false if there is " " in the verified IBAN | ||
return isValidIBAN(extractIBAN(iban).iban); | ||
return isValidIBAN(electronicFormatIBAN(iban)); | ||
} | ||
return false; | ||
} |
19 changes: 19 additions & 0 deletions
19
...ges/stark-core/src/validation/validators/map-not-empty/map-not-empty.validator.fn.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { starkMapNotEmpty } from "./map-not-empty.validator.fn"; | ||
|
||
describe("Validator Function: StarkMapNotEmpty", () => { | ||
it("should return FALSE if the map is not of Map type", () => { | ||
const invalidMap: any = undefined; | ||
expect(starkMapNotEmpty(invalidMap)).toBe(false); | ||
}); | ||
|
||
it("should return TRUE if the map is of Map type and is not empty", () => { | ||
const validMap: Map<any, any> = new Map(); | ||
validMap.set("testKey", "testValue"); | ||
expect(starkMapNotEmpty(validMap)).toBe(true); | ||
}); | ||
|
||
it("should return FALSE if the map is empty", () => { | ||
const invalidMap: Map<any, any> = new Map(); | ||
expect(starkMapNotEmpty(invalidMap)).toBe(false); | ||
}); | ||
}); |