├── .babelrc
├── src
├── index.ts
├── validator.ts
├── validator.business.ts
├── validator.spec.ts
└── validator.business.spec.ts
├── .eslintignore
├── .prettierrc
├── config
└── test
│ └── jest.json
├── .editorconfig
├── .gitignore
├── typings
└── index.d.ts
├── examples
├── ts
│ ├── tsconfig.json
│ ├── index.html
│ ├── package.json
│ ├── readme.md
│ └── src
│ │ └── index.ts
└── js
│ ├── index.html
│ ├── package.json
│ ├── readme.md
│ └── src
│ └── index.js
├── .circleci
└── config.yml
├── .eslintrc.js
├── tsconfig.json
├── .vscode
└── launch.json
├── LICENSE
├── rollup.config.js
├── README.md
└── package.json
/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": ["@babel/preset-env"]
3 | }
4 |
--------------------------------------------------------------------------------
/src/index.ts:
--------------------------------------------------------------------------------
1 | import * as iban from './validator';
2 |
3 | export { iban };
4 |
--------------------------------------------------------------------------------
/.eslintignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | .rpt2_cache
3 | .vscode
4 | config
5 | dist
6 | *.spec.ts
7 |
--------------------------------------------------------------------------------
/.prettierrc:
--------------------------------------------------------------------------------
1 | {
2 | "singleQuote": true,
3 | "trailingComma": "es5",
4 | "endOfLine": "auto"
5 | }
6 |
--------------------------------------------------------------------------------
/config/test/jest.json:
--------------------------------------------------------------------------------
1 | {
2 | "rootDir": "../../",
3 | "preset": "ts-jest",
4 | "restoreMocks": true
5 | }
6 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | indent_style = space
5 | indent_size = 2
6 | end_of_line = lf
7 | charset = utf-8
8 | trim_trailing_whitespace = true
9 | insert_final_newline = true
10 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | .DS_Store
3 | dist/
4 | *.orig
5 | .idea/
6 | */src/**/*.js.map
7 | *.log
8 | package-lock.json
9 | coverage/
10 | .awcache/
11 | .rpt2_cache
12 | react-app-env.d.ts
13 | .cache
14 |
--------------------------------------------------------------------------------
/typings/index.d.ts:
--------------------------------------------------------------------------------
1 | import { FieldValidationFunctionSync } from '@lemoncode/fonk';
2 |
3 | export namespace iban {
4 | export const validator: FieldValidationFunctionSync;
5 | export function setErrorMessage(message: string | string[]): void;
6 | }
7 |
--------------------------------------------------------------------------------
/examples/ts/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "module": "commonjs",
4 | "jsx": "preserve",
5 | "esModuleInterop": true,
6 | "sourceMap": true,
7 | "allowJs": true,
8 | "lib": ["es6", "dom"],
9 | "rootDir": "src",
10 | "moduleResolution": "node"
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/examples/js/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | fonk-iban-validator, javascript example
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/examples/ts/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | fonk-iban-validator, typescript example
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.circleci/config.yml:
--------------------------------------------------------------------------------
1 | version: 2
2 | jobs:
3 | build:
4 | working_directory: ~/test-ci-code
5 | docker:
6 | - image: circleci/node:10
7 | steps:
8 | - checkout
9 | - run:
10 | name: install
11 | command: 'npm install'
12 | - run:
13 | name: validate
14 | command: 'npm run validate'
15 |
--------------------------------------------------------------------------------
/.eslintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | parser: '@typescript-eslint/parser',
3 | extends: [
4 | 'plugin:@typescript-eslint/recommended',
5 | 'prettier/@typescript-eslint',
6 | 'plugin:prettier/recommended',
7 | ],
8 | plugins: ['@typescript-eslint', 'prettier'],
9 | rules: {
10 | '@typescript-eslint/no-explicit-any': 'off',
11 | '@typescript-eslint/explicit-function-return-type': 'off',
12 | },
13 | };
14 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es6",
4 | "module": "es6",
5 | "moduleResolution": "node",
6 | "declaration": false,
7 | "noImplicitAny": false,
8 | "sourceMap": true,
9 | "jsx": "react",
10 | "noLib": false,
11 | "allowJs": true,
12 | "suppressImplicitAnyIndexErrors": true,
13 | "skipLibCheck": true,
14 | "esModuleInterop": true
15 | },
16 | "include": ["./src/**/*"]
17 | }
18 |
--------------------------------------------------------------------------------
/examples/js/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "fonk-iban-validator-js-example",
3 | "version": "1.0.0",
4 | "description": "fonk-iban-validator, javascript example",
5 | "main": "index.html",
6 | "scripts": {
7 | "start": "parcel index.html --open"
8 | },
9 | "dependencies": {
10 | "@lemoncode/fonk": "latest",
11 | "@lemoncode/fonk-iban-validator": "latest"
12 | },
13 | "devDependencies": {
14 | "@babel/core": "^7.6.0",
15 | "parcel-bundler": "^1.6.1"
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/examples/ts/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "fonk-iban-validator-ts-example",
3 | "version": "1.0.0",
4 | "description": "fonk-iban-validator, typescript example",
5 | "main": "index.html",
6 | "scripts": {
7 | "start": "parcel index.html --open"
8 | },
9 | "dependencies": {
10 | "@lemoncode/fonk": "latest",
11 | "@lemoncode/fonk-iban-validator": "latest"
12 | },
13 | "devDependencies": {
14 | "@babel/core": "^7.6.0",
15 | "parcel-bundler": "^1.6.1"
16 | }
17 | }
18 |
19 |
--------------------------------------------------------------------------------
/.vscode/launch.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "0.2.0",
3 | "configurations": [
4 | {
5 | "type": "node",
6 | "request": "launch",
7 | "name": "Jest selected file",
8 | "program": "${workspaceRoot}/node_modules/jest/bin/jest.js",
9 | "args": [
10 | "${fileBasenameNoExtension}",
11 | "-c",
12 | "./config/test/jest.json",
13 | "--verbose",
14 | "-i",
15 | "--no-cache",
16 | "--watchAll"
17 | ],
18 | "console": "integratedTerminal",
19 | "internalConsoleOptions": "neverOpen"
20 | }
21 | ]
22 | }
23 |
--------------------------------------------------------------------------------
/examples/js/readme.md:
--------------------------------------------------------------------------------
1 | # fonk-iban-validator example
2 |
3 | Example using `fonk-iban-validator`.
4 |
5 | [](https://codesandbox.io/s/github/lemoncode/fonk-iban-validator/tree/master/examples/js)
6 |
7 | # About Basefactor + Lemoncode
8 |
9 | We are an innovating team of Javascript experts, passionate about turning your ideas into robust products.
10 |
11 | [Basefactor, consultancy by Lemoncode](http://www.basefactor.com) provides consultancy and coaching services.
12 |
13 | [Lemoncode](http://lemoncode.net/services/en/#en-home) provides training services.
14 |
15 | For the LATAM/Spanish audience we are running an Online Front End Master degree, more info: http://lemoncode.net/master-frontend
16 |
--------------------------------------------------------------------------------
/examples/ts/readme.md:
--------------------------------------------------------------------------------
1 | # fonk-iban-validator example
2 |
3 | Example using `fonk-iban-validator`.
4 |
5 | [](https://codesandbox.io/s/github/lemoncode/fonk-iban-validator/tree/master/examples/ts)
6 |
7 | # About Basefactor + Lemoncode
8 |
9 | We are an innovating team of Javascript experts, passionate about turning your ideas into robust products.
10 |
11 | [Basefactor, consultancy by Lemoncode](http://www.basefactor.com) provides consultancy and coaching services.
12 |
13 | [Lemoncode](http://lemoncode.net/services/en/#en-home) provides training services.
14 |
15 | For the LATAM/Spanish audience we are running an Online Front End Master degree, more info: http://lemoncode.net/master-frontend
16 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2019 Lemoncode
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/examples/js/src/index.js:
--------------------------------------------------------------------------------
1 | import { createFormValidation } from '@lemoncode/fonk';
2 | import { iban } from '@lemoncode/fonk-iban-validator';
3 |
4 | const validationSchema = {
5 | field: {
6 | account: [iban.validator],
7 | },
8 | };
9 |
10 | const formValidation = createFormValidation(validationSchema);
11 |
12 | Promise.all([
13 | formValidation.validateField('account', 'ES7912345678901234567890'),
14 | formValidation.validateField('account', 'ES7921000813610123456789'),
15 | ]).then(([failedResult, succeededResult]) => {
16 | document.getElementById('app').innerHTML = `
17 |
18 |
Example with failed result:
19 |
20 |
21 | formValidation.validateField('account', 'ES7912345678901234567890')
22 |
23 |
24 |
Result:
25 |
26 | ${JSON.stringify(failedResult, null, 2)}
27 |
28 |
29 |
30 |
31 |
Example with succeeded result:
32 |
33 |
34 | formValidation.validateField('account', 'ES7921000813610123456789')
35 |
36 |
37 |
Result:
38 |
39 | ${JSON.stringify(succeededResult, null, 2)}
40 |
41 |
42 | `;
43 | });
44 |
--------------------------------------------------------------------------------
/src/validator.ts:
--------------------------------------------------------------------------------
1 | import { FieldValidationFunctionSync } from '@lemoncode/fonk';
2 | import {
3 | sanitizeValue,
4 | hasIbanPattern,
5 | hasValidLength,
6 | isValidIBAN,
7 | } from './validator.business';
8 |
9 | const VALIDATOR_TYPE = 'IBAN';
10 |
11 | let defaultMessage = 'Invalid IBAN';
12 |
13 | export const setErrorMessage = message => (defaultMessage = message);
14 |
15 | const isDefined = value => value !== void 0 && value !== null && value !== '';
16 |
17 | const validate = (value): boolean => {
18 | const sanitizedValue = sanitizeValue(value);
19 |
20 | return (
21 | hasIbanPattern(sanitizedValue) &&
22 | hasValidLength(sanitizedValue) &&
23 | isValidIBAN(sanitizedValue)
24 | );
25 | };
26 |
27 | const validateType = (value: string) => typeof value === 'string';
28 |
29 | export const validator: FieldValidationFunctionSync = fieldValidatorArgs => {
30 | const { value, message = defaultMessage } = fieldValidatorArgs;
31 |
32 | const succeeded =
33 | !isDefined(value) || (validateType(value) && validate(value));
34 |
35 | return {
36 | succeeded,
37 | message: succeeded ? '' : (message as string),
38 | type: VALIDATOR_TYPE,
39 | };
40 | };
41 |
--------------------------------------------------------------------------------
/examples/ts/src/index.ts:
--------------------------------------------------------------------------------
1 | import { ValidationSchema, createFormValidation } from '@lemoncode/fonk';
2 | import { iban } from '@lemoncode/fonk-iban-validator';
3 |
4 | const validationSchema: ValidationSchema = {
5 | field: {
6 | account: [iban.validator],
7 | },
8 | };
9 |
10 | const formValidation = createFormValidation(validationSchema);
11 |
12 | Promise.all([
13 | formValidation.validateField('account', 'ES7912345678901234567890'),
14 | formValidation.validateField('account', 'ES7921000813610123456789'),
15 | ]).then(([failedResult, succeededResult]) => {
16 | document.getElementById('app').innerHTML = `
17 |
18 |
Example with failed result:
19 |
20 |
21 | formValidation.validateField('account', 'ES7912345678901234567890')
22 |
23 |
24 |
Result:
25 |
26 | ${JSON.stringify(failedResult, null, 2)}
27 |
28 |
29 |
30 |
31 |
Example with succeeded result:
32 |
33 |
34 | formValidation.validateField('account', 'ES7921000813610123456789')
35 |
36 |
37 |
Result:
38 |
39 | ${JSON.stringify(succeededResult, null, 2)}
40 |
41 |
42 | `;
43 | });
44 |
--------------------------------------------------------------------------------
/rollup.config.js:
--------------------------------------------------------------------------------
1 | import resolve from 'rollup-plugin-node-resolve';
2 | import babel from 'rollup-plugin-babel';
3 | import commonjs from 'rollup-plugin-commonjs';
4 | import typescript from 'rollup-plugin-typescript2';
5 | import { terser } from 'rollup-plugin-terser';
6 | import { DEFAULT_EXTENSIONS } from '@babel/core';
7 | import pkg from './package.json';
8 |
9 | const builds = [
10 | { format: 'esm', minify: false },
11 | { format: 'cjs', minify: false },
12 | { format: 'umd', minify: false },
13 | { format: 'umd', minify: true },
14 | ];
15 | const extensions = [...DEFAULT_EXTENSIONS, '.ts'];
16 |
17 | export default builds.map(({ format, minify }) => {
18 | const minExtension = minify ? '.min' : '';
19 | return {
20 | input: 'src/index.ts',
21 | output: {
22 | name: pkg.name,
23 | exports: 'named',
24 | file: `dist/${pkg.name}.${format}${minExtension}.js`,
25 | format,
26 | globals: {
27 | '@lemoncode/fonk': 'Fonk',
28 | }, // Necessary for externals libraries and umd format
29 | },
30 | external: Object.keys(pkg.peerDependencies || {}),
31 | plugins: [
32 | resolve(),
33 | commonjs(),
34 | typescript({
35 | tsconfig: 'tsconfig.json',
36 | rollupCommonJSResolveHack: true, // To be compatible with commonjs plugin
37 | }),
38 | babel({
39 | extensions,
40 | exclude: 'node_modules/**',
41 | }),
42 | minify ? terser() : null,
43 | ],
44 | };
45 | });
46 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # fonk-iban-validator
2 |
3 | [](https://circleci.com/gh/Lemoncode/fonk-iban-validator/tree/master)
4 | [](https://www.npmjs.com/package/@lemoncode/fonk-iban-validator)
5 | [](https://bundlephobia.com/result?p=@lemoncode/fonk-iban-validator)
6 |
7 | This is a [fonk](https://github.com/Lemoncode/fonk) microlibrary that brings validation capabilities to:
8 |
9 | - Validate if a field of a form is a valid IBAN
10 |
11 | How to install it:
12 |
13 | ```bash
14 | npm install @lemoncode/fonk-iban-validator --save
15 | ```
16 |
17 | How to add it to an existing form validation schema:
18 |
19 | We have the following form model:
20 |
21 | ```
22 | const myFormValues = {
23 | account: 'ES7921000813610123456789',
24 | }
25 | ```
26 |
27 | We can add a iban validation to the myFormValues
28 |
29 | ```javascript
30 | import { iban } from '@lemoncode/fonk-iban-validator';
31 |
32 | const validationSchema = {
33 | field: {
34 | account: [iban.validator],
35 | },
36 | };
37 | ```
38 |
39 | You can customize the error message displayed in two ways:
40 |
41 | - Globally, replace the default error message in all validationSchemas (e.g. porting to spanish):
42 |
43 | ```javascript
44 | import { iban } from '@lemoncode/fonk-iban-validator';
45 |
46 | iban.setErrorMessage('El campo debe tener un formato IBAN válido');
47 | ```
48 |
49 | - Locally just override the error message for this validationSchema:
50 |
51 | ```javascript
52 | import { iban } from '@lemoncode/fonk-iban-validator';
53 |
54 | const validationSchema = {
55 | field: {
56 | account: [
57 | {
58 | validator: iban.validator,
59 | message: 'Field should have a valid IBAN format',
60 | },
61 | ],
62 | },
63 | };
64 | ```
65 |
66 | Please, refer to [fonk](https://github.com/Lemoncode/fonk) to learn more about form validation.
67 |
68 | ## License
69 |
70 | [MIT](./LICENSE)
71 |
72 | # About Basefactor + Lemoncode
73 |
74 | We are an innovating team of Javascript experts, passionate about turning your ideas into robust products.
75 |
76 | [Basefactor, consultancy by Lemoncode](http://www.basefactor.com) provides consultancy and coaching services.
77 |
78 | [Lemoncode](http://lemoncode.net/services/en/#en-home) provides training services.
79 |
80 | For the LATAM/Spanish audience we are running an Online Front End Master degree, more info: http://lemoncode.net/master-frontend
81 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@lemoncode/fonk-iban-validator",
3 | "version": "1.0.0",
4 | "description": "This is a [fonk](https://github.com/Lemoncode/fonk) microlibrary that brings validation capabilities to validate if a field of a form is a valid IBAN",
5 | "main": "dist/@lemoncode/fonk-iban-validator.cjs.js",
6 | "module": "dist/@lemoncode/fonk-iban-validator.esm.js",
7 | "typings": "typings/index.d.ts",
8 | "files": [
9 | "dist",
10 | "typings"
11 | ],
12 | "scripts": {
13 | "build": "npm run clean && rollup --config",
14 | "clean": "rimraf dist .rpt2_cache package-lock.json",
15 | "validate": "npm run lint && npm run build && npm run test && npm run test:size",
16 | "lint": "eslint src --ext .ts ",
17 | "lint:fix": "npm run lint -- --fix",
18 | "test": "jest -c ./config/test/jest.json --verbose",
19 | "test:watch": "jest -c ./config/test/jest.json --verbose --watchAll -i",
20 | "test:size": "bundlesize",
21 | "deploy": "npm run validate && np",
22 | "deploy:beta": "npm run validate && np --tag=beta --any-branch"
23 | },
24 | "bundlesize": [
25 | {
26 | "path": "./dist/**/*.js",
27 | "maxSize": "2kB"
28 | }
29 | ],
30 | "repository": {
31 | "type": "git",
32 | "url": "git+https://github.com/Lemoncode/fonk-iban-validator.git"
33 | },
34 | "keywords": [
35 | "iban",
36 | "validator",
37 | "fonk",
38 | "form validation",
39 | "validate",
40 | "sync validation"
41 | ],
42 | "author": "Lemoncode",
43 | "license": "MIT",
44 | "bugs": {
45 | "url": "https://github.com/Lemoncode/fonk-iban-validator/issues"
46 | },
47 | "homepage": "https://github.com/Lemoncode/fonk-iban-validator#readme",
48 | "peerDependencies": {
49 | "@lemoncode/fonk": "latest"
50 | },
51 | "devDependencies": {
52 | "@babel/cli": "^7.5.5",
53 | "@babel/core": "^7.5.5",
54 | "@babel/preset-env": "^7.5.5",
55 | "@lemoncode/fonk": "latest",
56 | "@types/jest": "^24.0.18",
57 | "@typescript-eslint/eslint-plugin": "^2.0.0",
58 | "@typescript-eslint/parser": "^2.0.0",
59 | "bundlesize": "0.18.0",
60 | "eslint": "^6.2.1",
61 | "eslint-config-prettier": "^6.1.0",
62 | "eslint-plugin-prettier": "^3.1.0",
63 | "husky": "^3.0.4",
64 | "jest": "^24.9.0",
65 | "lint-staged": "^9.2.3",
66 | "np": "^5.0.3",
67 | "prettier": "^1.18.2",
68 | "pretty-quick": "^1.11.1",
69 | "rimraf": "^3.0.0",
70 | "rollup": "^1.20.0",
71 | "rollup-plugin-babel": "^4.3.3",
72 | "rollup-plugin-commonjs": "^10.0.2",
73 | "rollup-plugin-node-resolve": "^5.2.0",
74 | "rollup-plugin-terser": "^5.1.1",
75 | "rollup-plugin-typescript2": "^0.22.1",
76 | "ts-jest": "^24.0.2",
77 | "typescript": "^3.5.3"
78 | },
79 | "husky": {
80 | "hooks": {
81 | "pre-commit": "lint-staged"
82 | }
83 | },
84 | "lint-staged": {
85 | "src/**/*.{ts,tsx}": [
86 | "npm run lint:fix",
87 | "pretty-quick — staged",
88 | "git add"
89 | ]
90 | },
91 | "publishConfig": {
92 | "registry": "https://registry.npmjs.org/",
93 | "access": "public"
94 | }
95 | }
96 |
--------------------------------------------------------------------------------
/src/validator.business.ts:
--------------------------------------------------------------------------------
1 | export const sanitizeValue = (value: string): string =>
2 | value.replace(/\s/g, '').toUpperCase();
3 |
4 | const ibanPattern = /^[a-zA-Z]{2}[a-zA-Z0-9]*$/;
5 |
6 | export const hasIbanPattern = (value: any): boolean => ibanPattern.test(value);
7 |
8 | const getCountry = (value: string): string => value.substring(0, 2);
9 |
10 | const getIBANLengthByCountry = (value: string): number => {
11 | switch (value) {
12 | case 'AD':
13 | return 24;
14 | case 'AE':
15 | return 23;
16 | case 'AL':
17 | return 28;
18 | case 'AO':
19 | return 25;
20 | case 'AT':
21 | return 20;
22 | case 'AZ':
23 | return 28;
24 | case 'BA':
25 | return 20;
26 | case 'BE':
27 | return 16;
28 | case 'BF':
29 | return 27;
30 | case 'BG':
31 | return 22;
32 | case 'BH':
33 | return 22;
34 | case 'BI':
35 | return 16;
36 | case 'BJ':
37 | return 28;
38 | case 'BR':
39 | return 29;
40 | case 'BY':
41 | return 28;
42 | case 'CH':
43 | return 21;
44 | case 'CI':
45 | return 28;
46 | case 'CM':
47 | return 27;
48 | case 'CR':
49 | return 22;
50 | case 'CV':
51 | return 25;
52 | case 'CY':
53 | return 28;
54 | case 'CZ':
55 | return 24;
56 | case 'DE':
57 | return 22;
58 | case 'DK':
59 | return 18;
60 | case 'DO':
61 | return 28;
62 | case 'DZ':
63 | return 24;
64 | case 'EE':
65 | return 20;
66 | case 'ES':
67 | return 24;
68 | case 'FI':
69 | return 18;
70 | case 'FO':
71 | return 18;
72 | case 'FR':
73 | return 27;
74 | case 'GB':
75 | return 22;
76 | case 'GE':
77 | return 22;
78 | case 'GI':
79 | return 23;
80 | case 'GL':
81 | return 18;
82 | case 'GR':
83 | return 27;
84 | case 'GT':
85 | return 28;
86 | case 'HR':
87 | return 21;
88 | case 'HU':
89 | return 28;
90 | case 'IE':
91 | return 22;
92 | case 'IL':
93 | return 23;
94 | case 'IQ':
95 | return 23;
96 | case 'IS':
97 | return 26;
98 | case 'IR':
99 | return 26;
100 | case 'IT':
101 | return 27;
102 | case 'JO':
103 | return 30;
104 | case 'KW':
105 | return 30;
106 | case 'KZ':
107 | return 20;
108 | case 'LB':
109 | return 28;
110 | case 'LC':
111 | return 32;
112 | case 'LI':
113 | return 21;
114 | case 'LT':
115 | return 20;
116 | case 'LU':
117 | return 20;
118 | case 'LV':
119 | return 21;
120 | case 'MC':
121 | return 27;
122 | case 'MD':
123 | return 24;
124 | case 'ME':
125 | return 22;
126 | case 'MG':
127 | return 27;
128 | case 'MK':
129 | return 19;
130 | case 'ML':
131 | return 28;
132 | case 'MR':
133 | return 27;
134 | case 'MT':
135 | return 31;
136 | case 'MU':
137 | return 30;
138 | case 'MZ':
139 | return 25;
140 | case 'NL':
141 | return 18;
142 | case 'NO':
143 | return 15;
144 | case 'PK':
145 | return 24;
146 | case 'PL':
147 | return 28;
148 | case 'PS':
149 | return 29;
150 | case 'PT':
151 | return 25;
152 | case 'QA':
153 | return 29;
154 | case 'RO':
155 | return 24;
156 | case 'RS':
157 | return 22;
158 | case 'SA':
159 | return 24;
160 | case 'SC':
161 | return 31;
162 | case 'SE':
163 | return 24;
164 | case 'SI':
165 | return 19;
166 | case 'SK':
167 | return 24;
168 | case 'SM':
169 | return 27;
170 | case 'SN':
171 | return 28;
172 | case 'ST':
173 | return 25;
174 | case 'SV':
175 | return 28;
176 | case 'TN':
177 | return 24;
178 | case 'TL':
179 | return 23;
180 | case 'TR':
181 | return 26;
182 | case 'UA':
183 | return 29;
184 | case 'VG':
185 | return 24;
186 | case 'XK':
187 | return 20;
188 | default:
189 | return 0;
190 | }
191 | };
192 |
193 | export const hasValidLength = (value: string) => {
194 | const country = getCountry(value);
195 | const ibanLength = getIBANLengthByCountry(country);
196 | return ibanLength !== 0 && value.length === ibanLength;
197 | };
198 |
199 | const moveControlCodeToEnd = (value: string): string =>
200 | `${value.substring(4, value.length)}${value.substring(0, 4)}`;
201 |
202 | const parseToNumber = (char: string): string =>
203 | (char.charCodeAt(0) - 55).toString();
204 |
205 | const parseIBANToNumbers = (value: string): string =>
206 | value
207 | .split('')
208 | .reduce(
209 | (result, char) =>
210 | !isNaN(Number(char))
211 | ? `${result}${char}`
212 | : `${result}${parseToNumber(char)}`,
213 | ''
214 | );
215 |
216 | const calculateReminder = (input: string): number => {
217 | let value: string = input;
218 | while (value.length >= 9) {
219 | const partial: string = value.substring(0, 9);
220 | const rest: string = value.substring(9);
221 | const num: number = Number(partial) % 97;
222 | value = `${num}${rest}`;
223 | }
224 | return Number(value) % 97;
225 | };
226 |
227 | export const isValidIBAN = (value: string) => {
228 | const rearrangedIBAN = moveControlCodeToEnd(value);
229 | const ibanNumber = parseIBANToNumbers(rearrangedIBAN);
230 | const remainder = calculateReminder(ibanNumber);
231 | return remainder === 1;
232 | };
233 |
--------------------------------------------------------------------------------
/src/validator.spec.ts:
--------------------------------------------------------------------------------
1 | import { validator, setErrorMessage } from './validator';
2 |
3 | const VALIDATOR_TYPE = 'IBAN';
4 | const defaultMessage = 'Invalid IBAN';
5 |
6 | describe('fonk-iban-validator specs', () => {
7 | it('should return succeeded validation when it feeds value equals undefined', () => {
8 | // Arrange
9 | const value = void 0;
10 |
11 | // Act
12 | const result = validator({ value });
13 |
14 | // Assert
15 | expect(result).toEqual({
16 | succeeded: true,
17 | message: '',
18 | type: VALIDATOR_TYPE,
19 | });
20 | });
21 |
22 | it('should return succeeded validation when it feeds value equals null', () => {
23 | // Arrange
24 | const value = null;
25 |
26 | // Act
27 | const result = validator({ value });
28 |
29 | // Assert
30 | expect(result).toEqual({
31 | succeeded: true,
32 | message: '',
33 | type: VALIDATOR_TYPE,
34 | });
35 | });
36 |
37 | it('should return succeeded validation when it feeds value equals empty string', () => {
38 | // Arrange
39 | const value = '';
40 |
41 | // Act
42 | const result = validator({ value });
43 |
44 | // Assert
45 | expect(result).toEqual({
46 | succeeded: true,
47 | message: '',
48 | type: VALIDATOR_TYPE,
49 | });
50 | });
51 |
52 | it('should overwrite default message when it feeds value and message', () => {
53 | // Arrange
54 | const value = 'test';
55 | const message = 'other message';
56 |
57 | // Act
58 | const result = validator({ value, message });
59 |
60 | // Assert
61 | expect(result).toEqual({
62 | succeeded: false,
63 | message: 'other message',
64 | type: VALIDATOR_TYPE,
65 | });
66 | });
67 |
68 | it('should return succeded validation when it feeds value equals valid IBAN with spaces', () => {
69 | // Arrange
70 | const value = 'ES912 100041845020005 1332';
71 |
72 | // Act
73 | const result = validator({ value });
74 |
75 | // Assert
76 | expect(result).toEqual({
77 | succeeded: true,
78 | message: '',
79 | type: VALIDATOR_TYPE,
80 | });
81 | });
82 |
83 | it('should return succeded validation when it feeds value equals valid IBAN from (Albania)', () => {
84 | // Arrange
85 | const value = 'AL47212110090000000235698741';
86 |
87 | // Act
88 | const result = validator({ value });
89 |
90 | // Assert
91 | expect(result).toEqual({
92 | succeeded: true,
93 | message: '',
94 | type: VALIDATOR_TYPE,
95 | });
96 | });
97 |
98 | it('should return failed validation when it feeds value equals invalid IBAN from (Albania)', () => {
99 | // Arrange
100 | const value = 'AL47212110190000000235698741';
101 |
102 | // Act
103 | const result = validator({ value });
104 |
105 | // Assert
106 | expect(result).toEqual({
107 | succeeded: false,
108 | message: defaultMessage,
109 | type: VALIDATOR_TYPE,
110 | });
111 | });
112 |
113 | // ** Algeria
114 | it('should return succeded validation when it feeds value equals valid IBAN from (Algeria)', () => {
115 | // Arrange
116 | const value = 'DZ4000400174401001050486';
117 |
118 | // Act
119 | const result = validator({ value });
120 |
121 | // Assert
122 | expect(result).toEqual({
123 | succeeded: true,
124 | message: '',
125 | type: VALIDATOR_TYPE,
126 | });
127 | });
128 |
129 | it('should return failed validation when it feeds value equals invalid IBAN from (Algeria)', () => {
130 | // Arrange
131 | const value = 'DZ4001400174401001050486';
132 |
133 | // Act
134 | const result = validator({ value });
135 |
136 | // Assert
137 | expect(result).toEqual({
138 | succeeded: false,
139 | message: defaultMessage,
140 | type: VALIDATOR_TYPE,
141 | });
142 | });
143 |
144 | // ** Angola
145 | it('should return succeded validation when it feeds value equals valid IBAN from (Angola)', () => {
146 | // Arrange
147 | const value = 'AO06000600000100037131174';
148 |
149 | // Act
150 | const result = validator({ value });
151 |
152 | // Assert
153 | expect(result).toEqual({
154 | succeeded: true,
155 | message: '',
156 | type: VALIDATOR_TYPE,
157 | });
158 | });
159 |
160 | it('should return failed validation when it feeds value equals invalid IBAN from (Angola)', () => {
161 | // Arrange
162 | const value = 'AO06000600200100037131174';
163 |
164 | // Act
165 | const result = validator({ value });
166 |
167 | // Assert
168 | expect(result).toEqual({
169 | succeeded: false,
170 | message: defaultMessage,
171 | type: VALIDATOR_TYPE,
172 | });
173 | });
174 |
175 | // ** Andorra
176 | it('should return succeded validation when it feeds value equals valid IBAN from (Andorra)', () => {
177 | // Arrange
178 | const value = 'AD1200012030200359100100';
179 |
180 | // Act
181 | const result = validator({ value });
182 |
183 | // Assert
184 | expect(result).toEqual({
185 | succeeded: true,
186 | message: '',
187 | type: VALIDATOR_TYPE,
188 | });
189 | });
190 |
191 | it('should return failed validation when it feeds value equals invalid IBAN from (Andorra)', () => {
192 | // Arrange
193 | const value = 'AD1220012030200359100100';
194 |
195 | // Act
196 | const result = validator({ value });
197 |
198 | // Assert
199 | expect(result).toEqual({
200 | succeeded: false,
201 | message: defaultMessage,
202 | type: VALIDATOR_TYPE,
203 | });
204 | });
205 |
206 | // ** Austria
207 | it('should return succeded validation when it feeds value equals valid IBAN from (Austria)', () => {
208 | // Arrange
209 | const value = 'AT611904300234573201';
210 |
211 | // Act
212 | const result = validator({ value });
213 |
214 | // Assert
215 | expect(result).toEqual({
216 | succeeded: true,
217 | message: '',
218 | type: VALIDATOR_TYPE,
219 | });
220 | });
221 |
222 | it('should return failed validation when it feeds value equals invalid IBAN from (Austria)', () => {
223 | // Arrange
224 | const value = 'AT611904300234573501';
225 |
226 | // Act
227 | const result = validator({ value });
228 |
229 | // Assert
230 | expect(result).toEqual({
231 | succeeded: false,
232 | message: defaultMessage,
233 | type: VALIDATOR_TYPE,
234 | });
235 | });
236 |
237 | // ** Azerbaijan
238 | it('should return succeded validation when it feeds value equals valid IBAN from (Azerbaijan)', () => {
239 | // Arrange
240 | const value = 'AZ21NABZ00000000137010001944';
241 |
242 | // Act
243 | const result = validator({ value });
244 |
245 | // Assert
246 | expect(result).toEqual({
247 | succeeded: true,
248 | message: '',
249 | type: VALIDATOR_TYPE,
250 | });
251 | });
252 |
253 | it('should return failed validation when it feeds value equals invalid IBAN from (Azerbaijan)', () => {
254 | // Arrange
255 | const value = 'AZ21NABZ00000000137010001344';
256 |
257 | // Act
258 | const result = validator({ value });
259 |
260 | // Assert
261 | expect(result).toEqual({
262 | succeeded: false,
263 | message: defaultMessage,
264 | type: VALIDATOR_TYPE,
265 | });
266 | });
267 |
268 | // ** Bahrain
269 | it('should return succeded validation when it feeds value equals valid IBAN from (Bahrain)', () => {
270 | // Arrange
271 | const value = 'BH29BMAG1299123456BH00';
272 |
273 | // Act
274 | const result = validator({ value });
275 |
276 | // Assert
277 | expect(result).toEqual({
278 | succeeded: true,
279 | message: '',
280 | type: VALIDATOR_TYPE,
281 | });
282 | });
283 |
284 | it('should return failed validation when it feeds value equals invalid IBAN from (Bahrain)', () => {
285 | // Arrange
286 | const value = 'BH29B3AG1299123456BH00';
287 |
288 | // Act
289 | const result = validator({ value });
290 |
291 | // Assert
292 | expect(result).toEqual({
293 | succeeded: false,
294 | message: defaultMessage,
295 | type: VALIDATOR_TYPE,
296 | });
297 | });
298 |
299 | // ** Bosnia and Herzegovina
300 | it('should return succeded validation when it feeds value equals valid IBAN from (Bosnia and Herzegovina)', () => {
301 | // Arrange
302 | const value = 'BA391290079401028494';
303 |
304 | // Act
305 | const result = validator({ value });
306 |
307 | // Assert
308 | expect(result).toEqual({
309 | succeeded: true,
310 | message: '',
311 | type: VALIDATOR_TYPE,
312 | });
313 | });
314 |
315 | it('should return failed validation when it feeds value equals invalid IBAN from (Bosnia and Herzegovina)', () => {
316 | // Arrange
317 | const value = 'BA391290039401028494';
318 |
319 | // Act
320 | const result = validator({ value });
321 |
322 | // Assert
323 | expect(result).toEqual({
324 | succeeded: false,
325 | message: defaultMessage,
326 | type: VALIDATOR_TYPE,
327 | });
328 | });
329 |
330 | // ** Belgium
331 | it('should return succeded validation when it feeds value equals valid IBAN from (Belgium)', () => {
332 | // Arrange
333 | const value = 'BE68539007547034';
334 |
335 | // Act
336 | const result = validator({ value });
337 |
338 | // Assert
339 | expect(result).toEqual({
340 | succeeded: true,
341 | message: '',
342 | type: VALIDATOR_TYPE,
343 | });
344 | });
345 |
346 | it('should return failed validation when it feeds value equals invalid IBAN from (Belgium)', () => {
347 | // Arrange
348 | const value = 'BE68539007544034';
349 |
350 | // Act
351 | const result = validator({ value });
352 |
353 | // Assert
354 | expect(result).toEqual({
355 | succeeded: false,
356 | message: defaultMessage,
357 | type: VALIDATOR_TYPE,
358 | });
359 | });
360 |
361 | // ** Benin
362 | it('should return succeded validation when it feeds value equals valid IBAN from (Benin)', () => {
363 | // Arrange
364 | const value = 'BJ11B00610100400271101192591';
365 |
366 | // Act
367 | const result = validator({ value });
368 |
369 | // Assert
370 | expect(result).toEqual({
371 | succeeded: true,
372 | message: '',
373 | type: VALIDATOR_TYPE,
374 | });
375 | });
376 |
377 | it('should return failed validation when it feeds value equals invalid IBAN from (Benin)', () => {
378 | // Arrange
379 | const value = 'BJ11B00610100403271101192591';
380 |
381 | // Act
382 | const result = validator({ value });
383 |
384 | // Assert
385 | expect(result).toEqual({
386 | succeeded: false,
387 | message: defaultMessage,
388 | type: VALIDATOR_TYPE,
389 | });
390 | });
391 |
392 | // ** Brazil
393 | it('should return succeded validation when it feeds value equals valid IBAN from (Brazil)', () => {
394 | // Arrange
395 | const value = 'BR9700360305000010009795493P1';
396 |
397 | // Act
398 | const result = validator({ value });
399 |
400 | // Assert
401 | expect(result).toEqual({
402 | succeeded: true,
403 | message: '',
404 | type: VALIDATOR_TYPE,
405 | });
406 | });
407 |
408 | it('should return failed validation when it feeds value equals invalid IBAN from (Brazil)', () => {
409 | // Arrange
410 | const value = 'BR9700360303000010009795493P1';
411 |
412 | // Act
413 | const result = validator({ value });
414 |
415 | // Assert
416 | expect(result).toEqual({
417 | succeeded: false,
418 | message: defaultMessage,
419 | type: VALIDATOR_TYPE,
420 | });
421 | });
422 |
423 | // ** Burkina Faso
424 | it('should return succeded validation when it feeds value equals valid IBAN from (Burkina Faso)', () => {
425 | // Arrange
426 | const value = 'BF1030134020015400945000643';
427 |
428 | // Act
429 | const result = validator({ value });
430 |
431 | // Assert
432 | expect(result).toEqual({
433 | succeeded: true,
434 | message: '',
435 | type: VALIDATOR_TYPE,
436 | });
437 | });
438 |
439 | it('should return failed validation when it feeds value equals invalid IBAN from (Burkina Faso)', () => {
440 | // Arrange
441 | const value = 'BF1030134020015430945000643';
442 |
443 | // Act
444 | const result = validator({ value });
445 |
446 | // Assert
447 | expect(result).toEqual({
448 | succeeded: false,
449 | message: defaultMessage,
450 | type: VALIDATOR_TYPE,
451 | });
452 | });
453 |
454 | // ** Bulgaria
455 | it('should return succeded validation when it feeds value equals valid IBAN from (Bulgaria)', () => {
456 | // Arrange
457 | const value = 'BG80BNBG96611020345678';
458 |
459 | // Act
460 | const result = validator({ value });
461 |
462 | // Assert
463 | expect(result).toEqual({
464 | succeeded: true,
465 | message: '',
466 | type: VALIDATOR_TYPE,
467 | });
468 | });
469 |
470 | it('should return failed validation when it feeds value equals invalid IBAN from (Bulgaria)', () => {
471 | // Arrange
472 | const value = 'BG80BNBG96612020345678';
473 |
474 | // Act
475 | const result = validator({ value });
476 |
477 | // Assert
478 | expect(result).toEqual({
479 | succeeded: false,
480 | message: defaultMessage,
481 | type: VALIDATOR_TYPE,
482 | });
483 | });
484 |
485 | // ** Burundi
486 | it('should return succeded validation when it feeds value equals valid IBAN from (Burundi)', () => {
487 | // Arrange
488 | const value = 'BI43201011067444';
489 |
490 | // Act
491 | const result = validator({ value });
492 |
493 | // Assert
494 | expect(result).toEqual({
495 | succeeded: true,
496 | message: '',
497 | type: VALIDATOR_TYPE,
498 | });
499 | });
500 |
501 | it('should return failed validation when it feeds value equals invalid IBAN from (Burundi)', () => {
502 | // Arrange
503 | const value = 'BI43201013067444';
504 |
505 | // Act
506 | const result = validator({ value });
507 |
508 | // Assert
509 | expect(result).toEqual({
510 | succeeded: false,
511 | message: defaultMessage,
512 | type: VALIDATOR_TYPE,
513 | });
514 | });
515 |
516 | // ** Cameroon
517 | it('should return succeded validation when it feeds value equals valid IBAN from (Cameroon)', () => {
518 | // Arrange
519 | const value = 'CM2110003001000500000605306';
520 |
521 | // Act
522 | const result = validator({ value });
523 |
524 | // Assert
525 | expect(result).toEqual({
526 | succeeded: true,
527 | message: '',
528 | type: VALIDATOR_TYPE,
529 | });
530 | });
531 |
532 | it('should return failed validation when it feeds value equals invalid IBAN from (Cameroon)', () => {
533 | // Arrange
534 | const value = 'CM2110003001000200000605306';
535 |
536 | // Act
537 | const result = validator({ value });
538 |
539 | // Assert
540 | expect(result).toEqual({
541 | succeeded: false,
542 | message: defaultMessage,
543 | type: VALIDATOR_TYPE,
544 | });
545 | });
546 |
547 | // ** Cape Verde
548 | it('should return succeded validation when it feeds value equals valid IBAN from (Cape Verde)', () => {
549 | // Arrange
550 | const value = 'CV64000300004547069110176';
551 |
552 | // Act
553 | const result = validator({ value });
554 |
555 | // Assert
556 | expect(result).toEqual({
557 | succeeded: true,
558 | message: '',
559 | type: VALIDATOR_TYPE,
560 | });
561 | });
562 |
563 | it('should return failed validation when it feeds value equals invalid IBAN from (Cape Verde)', () => {
564 | // Arrange
565 | const value = 'CV64000300004547069110276';
566 |
567 | // Act
568 | const result = validator({ value });
569 |
570 | // Assert
571 | expect(result).toEqual({
572 | succeeded: false,
573 | message: defaultMessage,
574 | type: VALIDATOR_TYPE,
575 | });
576 | });
577 |
578 | // ** Costa Rica
579 | it('should return succeded validation when it feeds value equals valid IBAN from (Costa Rica)', () => {
580 | // Arrange
581 | const value = 'CR05 0152 0200 1026 2840 66';
582 |
583 | // Act
584 | const result = validator({ value });
585 |
586 | // Assert
587 | expect(result).toEqual({
588 | succeeded: true,
589 | message: '',
590 | type: VALIDATOR_TYPE,
591 | });
592 | });
593 |
594 | it('should return failed validation when it feeds value equals invalid IBAN from (Costa Rica)', () => {
595 | // Arrange
596 | const value = 'CR0515202001026274066';
597 |
598 | // Act
599 | const result = validator({ value });
600 |
601 | // Assert
602 | expect(result).toEqual({
603 | succeeded: false,
604 | message: defaultMessage,
605 | type: VALIDATOR_TYPE,
606 | });
607 | });
608 |
609 | // ** Croatia
610 | it('should return succeded validation when it feeds value equals valid IBAN from (Croatia)', () => {
611 | // Arrange
612 | const value = 'HR1210010051863000160';
613 |
614 | // Act
615 | const result = validator({ value });
616 |
617 | // Assert
618 | expect(result).toEqual({
619 | succeeded: true,
620 | message: '',
621 | type: VALIDATOR_TYPE,
622 | });
623 | });
624 |
625 | it('should return failed validation when it feeds value equals invalid IBAN from (Croatia)', () => {
626 | // Arrange
627 | const value = 'HR1210010051862000160';
628 |
629 | // Act
630 | const result = validator({ value });
631 |
632 | // Assert
633 | expect(result).toEqual({
634 | succeeded: false,
635 | message: defaultMessage,
636 | type: VALIDATOR_TYPE,
637 | });
638 | });
639 |
640 | // ** Cyprus
641 | it('should return succeded validation when it feeds value equals valid IBAN from (Cyprus)', () => {
642 | // Arrange
643 | const value = 'CY17002001280000001200527600';
644 |
645 | // Act
646 | const result = validator({ value });
647 |
648 | // Assert
649 | expect(result).toEqual({
650 | succeeded: true,
651 | message: '',
652 | type: VALIDATOR_TYPE,
653 | });
654 | });
655 |
656 | it('should return failed validation when it feeds value equals invalid IBAN from (Cyprus)', () => {
657 | // Arrange
658 | const value = 'CY17002001280000001200527500';
659 |
660 | // Act
661 | const result = validator({ value });
662 |
663 | // Assert
664 | expect(result).toEqual({
665 | succeeded: false,
666 | message: defaultMessage,
667 | type: VALIDATOR_TYPE,
668 | });
669 | });
670 |
671 | // ** Czech Republic
672 | it('should return succeded validation when it feeds value equals valid IBAN from (Cyprus)', () => {
673 | // Arrange
674 | const value = 'CZ6508000000192000145399';
675 |
676 | // Act
677 | const result = validator({ value });
678 |
679 | // Assert
680 | expect(result).toEqual({
681 | succeeded: true,
682 | message: '',
683 | type: VALIDATOR_TYPE,
684 | });
685 | });
686 |
687 | it('should return failed validation when it feeds value equals invalid IBAN from (Cyprus)', () => {
688 | // Arrange
689 | const value = 'CZ6508000000192000145299';
690 |
691 | // Act
692 | const result = validator({ value });
693 |
694 | // Assert
695 | expect(result).toEqual({
696 | succeeded: false,
697 | message: defaultMessage,
698 | type: VALIDATOR_TYPE,
699 | });
700 | });
701 |
702 | // ** Denmark
703 | it('should return succeded validation when it feeds value equals valid IBAN from (Denmark)', () => {
704 | // Arrange
705 | const value = 'DK5000400440116243';
706 |
707 | // Act
708 | const result = validator({ value });
709 |
710 | // Assert
711 | expect(result).toEqual({
712 | succeeded: true,
713 | message: '',
714 | type: VALIDATOR_TYPE,
715 | });
716 | });
717 |
718 | it('should return failed validation when it feeds value equals invalid IBAN from (Denmark)', () => {
719 | // Arrange
720 | const value = 'DK5000400440113243';
721 |
722 | // Act
723 | const result = validator({ value });
724 |
725 | // Assert
726 | expect(result).toEqual({
727 | succeeded: false,
728 | message: defaultMessage,
729 | type: VALIDATOR_TYPE,
730 | });
731 | });
732 |
733 | // ** Dominican Republic
734 | it('should return succeded validation when it feeds value equals valid IBAN from (Dominican Republic)', () => {
735 | // Arrange
736 | const value = 'DO28BAGR00000001212453611324';
737 |
738 | // Act
739 | const result = validator({ value });
740 |
741 | // Assert
742 | expect(result).toEqual({
743 | succeeded: true,
744 | message: '',
745 | type: VALIDATOR_TYPE,
746 | });
747 | });
748 |
749 | it('should return failed validation when it feeds value equals invalid IBAN from (Dominican Republic)', () => {
750 | // Arrange
751 | const value = 'DO28BAGR00000001312453611324';
752 |
753 | // Act
754 | const result = validator({ value });
755 |
756 | // Assert
757 | expect(result).toEqual({
758 | succeeded: false,
759 | message: defaultMessage,
760 | type: VALIDATOR_TYPE,
761 | });
762 | });
763 |
764 | // ** East Timor
765 | it('should return succeded validation when it feeds value equals valid IBAN from (East Timor)', () => {
766 | // Arrange
767 | const value = 'TL380080012345678910157';
768 |
769 | // Act
770 | const result = validator({ value });
771 |
772 | // Assert
773 | expect(result).toEqual({
774 | succeeded: true,
775 | message: '',
776 | type: VALIDATOR_TYPE,
777 | });
778 | });
779 |
780 | it('should return failed validation when it feeds value equals invalid IBAN from (East Timor)', () => {
781 | // Arrange
782 | const value = 'TL380080012345478910157';
783 |
784 | // Act
785 | const result = validator({ value });
786 |
787 | // Assert
788 | expect(result).toEqual({
789 | succeeded: false,
790 | message: defaultMessage,
791 | type: VALIDATOR_TYPE,
792 | });
793 | });
794 |
795 | // ** Estonia
796 | it('should return succeded validation when it feeds value equals valid IBAN from (Estonia)', () => {
797 | // Arrange
798 | const value = 'EE382200221020145685';
799 |
800 | // Act
801 | const result = validator({ value });
802 |
803 | // Assert
804 | expect(result).toEqual({
805 | succeeded: true,
806 | message: '',
807 | type: VALIDATOR_TYPE,
808 | });
809 | });
810 |
811 | it('should return failed validation when it feeds value equals invalid IBAN from (Estonia)', () => {
812 | // Arrange
813 | const value = 'EE482200221020145685';
814 |
815 | // Act
816 | const result = validator({ value });
817 |
818 | // Assert
819 | expect(result).toEqual({
820 | succeeded: false,
821 | message: defaultMessage,
822 | type: VALIDATOR_TYPE,
823 | });
824 | });
825 |
826 | // ** Faroe Islands
827 | it('should return succeded validation when it feeds value equals valid IBAN from (Faroe Islands)', () => {
828 | // Arrange
829 | const value = 'FO1464600009692713';
830 |
831 | // Act
832 | const result = validator({ value });
833 |
834 | // Assert
835 | expect(result).toEqual({
836 | succeeded: true,
837 | message: '',
838 | type: VALIDATOR_TYPE,
839 | });
840 | });
841 |
842 | it('should return failed validation when it feeds value equals invalid IBAN from (Faroe Islands)', () => {
843 | // Arrange
844 | const value = 'FO1464600009592713';
845 |
846 | // Act
847 | const result = validator({ value });
848 |
849 | // Assert
850 | expect(result).toEqual({
851 | succeeded: false,
852 | message: defaultMessage,
853 | type: VALIDATOR_TYPE,
854 | });
855 | });
856 |
857 | // ** Finland
858 | it('should return succeded validation when it feeds value equals valid IBAN from (Finland)', () => {
859 | // Arrange
860 | const value = 'FI2112345600000785';
861 |
862 | // Act
863 | const result = validator({ value });
864 |
865 | // Assert
866 | expect(result).toEqual({
867 | succeeded: true,
868 | message: '',
869 | type: VALIDATOR_TYPE,
870 | });
871 | });
872 |
873 | it('should return failed validation when it feeds value equals invalid IBAN from (Finland)', () => {
874 | // Arrange
875 | const value = 'FI2312345600000785';
876 |
877 | // Act
878 | const result = validator({ value });
879 |
880 | // Assert
881 | expect(result).toEqual({
882 | succeeded: false,
883 | message: defaultMessage,
884 | type: VALIDATOR_TYPE,
885 | });
886 | });
887 |
888 | // ** France
889 | it('should return succeded validation when it feeds value equals valid IBAN from (France)', () => {
890 | // Arrange
891 | const value = 'FR1420041010050500013M02606';
892 |
893 | // Act
894 | const result = validator({ value });
895 |
896 | // Assert
897 | expect(result).toEqual({
898 | succeeded: true,
899 | message: '',
900 | type: VALIDATOR_TYPE,
901 | });
902 | });
903 |
904 | it('should return failed validation when it feeds value equals invalid IBAN from (France)', () => {
905 | // Arrange
906 | const value = 'FR1450041010050500013M02606';
907 |
908 | // Act
909 | const result = validator({ value });
910 |
911 | // Assert
912 | expect(result).toEqual({
913 | succeeded: false,
914 | message: defaultMessage,
915 | type: VALIDATOR_TYPE,
916 | });
917 | });
918 |
919 | // ** Guatemala
920 | it('should return succeded validation when it feeds value equals valid IBAN from (Guatemala)', () => {
921 | // Arrange
922 | const value = 'GT82TRAJ01020000001210029690';
923 |
924 | // Act
925 | const result = validator({ value });
926 |
927 | // Assert
928 | expect(result).toEqual({
929 | succeeded: true,
930 | message: '',
931 | type: VALIDATOR_TYPE,
932 | });
933 | });
934 |
935 | it('should return failed validation when it feeds value equals invalid IBAN from (Guatemala)', () => {
936 | // Arrange
937 | const value = 'GT82TRAJ01020000001210028690';
938 |
939 | // Act
940 | const result = validator({ value });
941 |
942 | // Assert
943 | expect(result).toEqual({
944 | succeeded: false,
945 | message: defaultMessage,
946 | type: VALIDATOR_TYPE,
947 | });
948 | });
949 |
950 | // ** Georgia
951 | it('should return succeded validation when it feeds value equals valid IBAN from (Georgia)', () => {
952 | // Arrange
953 | const value = 'GE29NB0000000101904917';
954 |
955 | // Act
956 | const result = validator({ value });
957 |
958 | // Assert
959 | expect(result).toEqual({
960 | succeeded: true,
961 | message: '',
962 | type: VALIDATOR_TYPE,
963 | });
964 | });
965 |
966 | it('should return failed validation when it feeds value equals invalid IBAN from (Georgia)', () => {
967 | // Arrange
968 | const value = 'GE29NB0000000101904817';
969 |
970 | // Act
971 | const result = validator({ value });
972 |
973 | // Assert
974 | expect(result).toEqual({
975 | succeeded: false,
976 | message: defaultMessage,
977 | type: VALIDATOR_TYPE,
978 | });
979 | });
980 |
981 | // ** Germany
982 | it('should return succeded validation when it feeds value equals valid IBAN from (Germany)', () => {
983 | // Arrange
984 | const value = 'DE89370400440532013000';
985 |
986 | // Act
987 | const result = validator({ value });
988 |
989 | // Assert
990 | expect(result).toEqual({
991 | succeeded: true,
992 | message: '',
993 | type: VALIDATOR_TYPE,
994 | });
995 | });
996 |
997 | it('should return failed validation when it feeds value equals invalid IBAN from (Germany)', () => {
998 | // Arrange
999 | const value = 'DE89370400430532013000';
1000 |
1001 | // Act
1002 | const result = validator({ value });
1003 |
1004 | // Assert
1005 | expect(result).toEqual({
1006 | succeeded: false,
1007 | message: defaultMessage,
1008 | type: VALIDATOR_TYPE,
1009 | });
1010 | });
1011 |
1012 | // ** Gibraltar
1013 | it('should return succeded validation when it feeds value equals valid IBAN from (Gibraltar)', () => {
1014 | // Arrange
1015 | const value = 'GI75NWBK000000007099453';
1016 |
1017 | // Act
1018 | const result = validator({ value });
1019 |
1020 | // Assert
1021 | expect(result).toEqual({
1022 | succeeded: true,
1023 | message: '',
1024 | type: VALIDATOR_TYPE,
1025 | });
1026 | });
1027 |
1028 | it('should return failed validation when it feeds value equals invalid IBAN from (Gibraltar)', () => {
1029 | // Arrange
1030 | const value = 'GI75NWIK000000007099453';
1031 |
1032 | // Act
1033 | const result = validator({ value });
1034 |
1035 | // Assert
1036 | expect(result).toEqual({
1037 | succeeded: false,
1038 | message: defaultMessage,
1039 | type: VALIDATOR_TYPE,
1040 | });
1041 | });
1042 |
1043 | // ** Greece
1044 | it('should return succeded validation when it feeds value equals valid IBAN from (Greece)', () => {
1045 | // Arrange
1046 | const value = 'GR1601101250000000012300695';
1047 |
1048 | // Act
1049 | const result = validator({ value });
1050 |
1051 | // Assert
1052 | expect(result).toEqual({
1053 | succeeded: true,
1054 | message: '',
1055 | type: VALIDATOR_TYPE,
1056 | });
1057 | });
1058 |
1059 | it('should return failed validation when it feeds value equals invalid IBAN from (Greece)', () => {
1060 | // Arrange
1061 | const value = 'GR1601101250000000012300694';
1062 |
1063 | // Act
1064 | const result = validator({ value });
1065 |
1066 | // Assert
1067 | expect(result).toEqual({
1068 | succeeded: false,
1069 | message: defaultMessage,
1070 | type: VALIDATOR_TYPE,
1071 | });
1072 | });
1073 |
1074 | // ** Greenland
1075 | it('should return succeded validation when it feeds value equals valid IBAN from (Greenland)', () => {
1076 | // Arrange
1077 | const value = 'GL8964710001000206';
1078 |
1079 | // Act
1080 | const result = validator({ value });
1081 |
1082 | // Assert
1083 | expect(result).toEqual({
1084 | succeeded: true,
1085 | message: '',
1086 | type: VALIDATOR_TYPE,
1087 | });
1088 | });
1089 |
1090 | it('should return failed validation when it feeds value equals invalid IBAN from (Greenland)', () => {
1091 | // Arrange
1092 | const value = 'GL8964710002000206';
1093 |
1094 | // Act
1095 | const result = validator({ value });
1096 |
1097 | // Assert
1098 | expect(result).toEqual({
1099 | succeeded: false,
1100 | message: defaultMessage,
1101 | type: VALIDATOR_TYPE,
1102 | });
1103 | });
1104 |
1105 | // ** Hungary
1106 | it('should return succeded validation when it feeds value equals valid IBAN from (Hungary)', () => {
1107 | // Arrange
1108 | const value = 'HU42117730161111101800000000';
1109 |
1110 | // Act
1111 | const result = validator({ value });
1112 |
1113 | // Assert
1114 | expect(result).toEqual({
1115 | succeeded: true,
1116 | message: '',
1117 | type: VALIDATOR_TYPE,
1118 | });
1119 | });
1120 |
1121 | it('should return failed validation when it feeds value equals invalid IBAN from (Hungary)', () => {
1122 | // Arrange
1123 | const value = 'HU42117730161111101800000010';
1124 |
1125 | // Act
1126 | const result = validator({ value });
1127 |
1128 | // Assert
1129 | expect(result).toEqual({
1130 | succeeded: false,
1131 | message: defaultMessage,
1132 | type: VALIDATOR_TYPE,
1133 | });
1134 | });
1135 |
1136 | // ** Iceland
1137 | it('should return succeded validation when it feeds value equals valid IBAN from (Iceland)', () => {
1138 | // Arrange
1139 | const value = 'IS140159260076545510730339';
1140 |
1141 | // Act
1142 | const result = validator({ value });
1143 |
1144 | // Assert
1145 | expect(result).toEqual({
1146 | succeeded: true,
1147 | message: '',
1148 | type: VALIDATOR_TYPE,
1149 | });
1150 | });
1151 |
1152 | it('should return failed validation when it feeds value equals invalid IBAN from (Iceland)', () => {
1153 | // Arrange
1154 | const value = 'IS140159260076545510730334';
1155 |
1156 | // Act
1157 | const result = validator({ value });
1158 |
1159 | // Assert
1160 | expect(result).toEqual({
1161 | succeeded: false,
1162 | message: defaultMessage,
1163 | type: VALIDATOR_TYPE,
1164 | });
1165 | });
1166 |
1167 | // ** Iran
1168 | it('should return succeded validation when it feeds value equals valid IBAN from (Iran)', () => {
1169 | // Arrange
1170 | const value = 'IR580540105180021273113007';
1171 |
1172 | // Act
1173 | const result = validator({ value });
1174 |
1175 | // Assert
1176 | expect(result).toEqual({
1177 | succeeded: true,
1178 | message: '',
1179 | type: VALIDATOR_TYPE,
1180 | });
1181 | });
1182 |
1183 | it('should return failed validation when it feeds value equals invalid IBAN from (Iran)', () => {
1184 | // Arrange
1185 | const value = 'IR580540105180021473113007';
1186 |
1187 | // Act
1188 | const result = validator({ value });
1189 |
1190 | // Assert
1191 | expect(result).toEqual({
1192 | succeeded: false,
1193 | message: defaultMessage,
1194 | type: VALIDATOR_TYPE,
1195 | });
1196 | });
1197 |
1198 | // ** Ireland
1199 | it('should return succeded validation when it feeds value equals valid IBAN from (Iran)', () => {
1200 | // Arrange
1201 | const value = 'IE29AIBK93115212345678';
1202 |
1203 | // Act
1204 | const result = validator({ value });
1205 |
1206 | // Assert
1207 | expect(result).toEqual({
1208 | succeeded: true,
1209 | message: '',
1210 | type: VALIDATOR_TYPE,
1211 | });
1212 | });
1213 |
1214 | it('should return failed validation when it feeds value equals invalid IBAN from (Iran)', () => {
1215 | // Arrange
1216 | const value = 'IE29AIBY93115212345678';
1217 |
1218 | // Act
1219 | const result = validator({ value });
1220 |
1221 | // Assert
1222 | expect(result).toEqual({
1223 | succeeded: false,
1224 | message: defaultMessage,
1225 | type: VALIDATOR_TYPE,
1226 | });
1227 | });
1228 |
1229 | // ** Israel
1230 | it('should return succeded validation when it feeds value equals valid IBAN from (Israel)', () => {
1231 | // Arrange
1232 | const value = 'IL620108000000099999999';
1233 |
1234 | // Act
1235 | const result = validator({ value });
1236 |
1237 | // Assert
1238 | expect(result).toEqual({
1239 | succeeded: true,
1240 | message: '',
1241 | type: VALIDATOR_TYPE,
1242 | });
1243 | });
1244 |
1245 | it('should return failed validation when it feeds value equals invalid IBAN from (Israel)', () => {
1246 | // Arrange
1247 | const value = 'IL620108000000099989999';
1248 |
1249 | // Act
1250 | const result = validator({ value });
1251 |
1252 | // Assert
1253 | expect(result).toEqual({
1254 | succeeded: false,
1255 | message: defaultMessage,
1256 | type: VALIDATOR_TYPE,
1257 | });
1258 | });
1259 |
1260 | // ** Italy
1261 | it('should return succeded validation when it feeds value equals valid IBAN from (Italy)', () => {
1262 | // Arrange
1263 | const value = 'IT60X0542811101000000123456';
1264 |
1265 | // Act
1266 | const result = validator({ value });
1267 |
1268 | // Assert
1269 | expect(result).toEqual({
1270 | succeeded: true,
1271 | message: '',
1272 | type: VALIDATOR_TYPE,
1273 | });
1274 | });
1275 |
1276 | it('should return failed validation when it feeds value equals invalid IBAN from (Italy)', () => {
1277 | // Arrange
1278 | const value = 'IT60X6542811101000000123456';
1279 |
1280 | // Act
1281 | const result = validator({ value });
1282 |
1283 | // Assert
1284 | expect(result).toEqual({
1285 | succeeded: false,
1286 | message: defaultMessage,
1287 | type: VALIDATOR_TYPE,
1288 | });
1289 | });
1290 |
1291 | // ** Ivory Coast
1292 | it('should return succeded validation when it feeds value equals valid IBAN from (Ivory Coast)', () => {
1293 | // Arrange
1294 | const value = 'CI05A00060174100178530011852';
1295 |
1296 | // Act
1297 | const result = validator({ value });
1298 |
1299 | // Assert
1300 | expect(result).toEqual({
1301 | succeeded: true,
1302 | message: '',
1303 | type: VALIDATOR_TYPE,
1304 | });
1305 | });
1306 |
1307 | it('should return failed validation when it feeds value equals invalid IBAN from (Ivory Coast)', () => {
1308 | // Arrange
1309 | const value = 'CI05A00060174100177530011852';
1310 |
1311 | // Act
1312 | const result = validator({ value });
1313 |
1314 | // Assert
1315 | expect(result).toEqual({
1316 | succeeded: false,
1317 | message: defaultMessage,
1318 | type: VALIDATOR_TYPE,
1319 | });
1320 | });
1321 |
1322 | // ** Jordan
1323 | it('should return succeded validation when it feeds value equals valid IBAN from (Jordan)', () => {
1324 | // Arrange
1325 | const value = 'JO94CBJO0010000000000131000302';
1326 |
1327 | // Act
1328 | const result = validator({ value });
1329 |
1330 | // Assert
1331 | expect(result).toEqual({
1332 | succeeded: true,
1333 | message: '',
1334 | type: VALIDATOR_TYPE,
1335 | });
1336 | });
1337 |
1338 | it('should return failed validation when it feeds value equals invalid IBAN from (Jordan)', () => {
1339 | // Arrange
1340 | const value = 'JO94CBJO0012000000000131000302';
1341 |
1342 | // Act
1343 | const result = validator({ value });
1344 |
1345 | // Assert
1346 | expect(result).toEqual({
1347 | succeeded: false,
1348 | message: defaultMessage,
1349 | type: VALIDATOR_TYPE,
1350 | });
1351 | });
1352 |
1353 | // ** Kazakhstan
1354 | it('should return succeded validation when it feeds value equals valid IBAN from (Kazakhstan)', () => {
1355 | // Arrange
1356 | const value = 'KZ176010251000042993';
1357 |
1358 | // Act
1359 | const result = validator({ value });
1360 |
1361 | // Assert
1362 | expect(result).toEqual({
1363 | succeeded: true,
1364 | message: '',
1365 | type: VALIDATOR_TYPE,
1366 | });
1367 | });
1368 |
1369 | it('should return failed validation when it feeds value equals invalid IBAN from (Kazakhstan)', () => {
1370 | // Arrange
1371 | const value = 'KZ176010251000042193';
1372 |
1373 | // Act
1374 | const result = validator({ value });
1375 |
1376 | // Assert
1377 | expect(result).toEqual({
1378 | succeeded: false,
1379 | message: defaultMessage,
1380 | type: VALIDATOR_TYPE,
1381 | });
1382 | });
1383 |
1384 | // ** Kuwait
1385 | it('should return succeded validation when it feeds value equals valid IBAN from (Kuwait)', () => {
1386 | // Arrange
1387 | const value = 'KW74NBOK0000000000001000372151';
1388 |
1389 | // Act
1390 | const result = validator({ value });
1391 |
1392 | // Assert
1393 | expect(result).toEqual({
1394 | succeeded: true,
1395 | message: '',
1396 | type: VALIDATOR_TYPE,
1397 | });
1398 | });
1399 |
1400 | it('should return failed validation when it feeds value equals invalid IBAN from (Kuwait)', () => {
1401 | // Arrange
1402 | const value = 'KW74NBOE0000000000001000372151';
1403 |
1404 | // Act
1405 | const result = validator({ value });
1406 |
1407 | // Assert
1408 | expect(result).toEqual({
1409 | succeeded: false,
1410 | message: defaultMessage,
1411 | type: VALIDATOR_TYPE,
1412 | });
1413 | });
1414 |
1415 | // ** Latvia
1416 | it('should return succeded validation when it feeds value equals valid IBAN from (Latvia)', () => {
1417 | // Arrange
1418 | const value = 'LV80BANK0000435195001';
1419 |
1420 | // Act
1421 | const result = validator({ value });
1422 |
1423 | // Assert
1424 | expect(result).toEqual({
1425 | succeeded: true,
1426 | message: '',
1427 | type: VALIDATOR_TYPE,
1428 | });
1429 | });
1430 |
1431 | it('should return failed validation when it feeds value equals invalid IBAN from (Latvia)', () => {
1432 | // Arrange
1433 | const value = 'LV80BANK0000425195001';
1434 |
1435 | // Act
1436 | const result = validator({ value });
1437 |
1438 | // Assert
1439 | expect(result).toEqual({
1440 | succeeded: false,
1441 | message: defaultMessage,
1442 | type: VALIDATOR_TYPE,
1443 | });
1444 | });
1445 |
1446 | // ** Lebanon
1447 | it('should return succeded validation when it feeds value equals valid IBAN from (Lebanon)', () => {
1448 | // Arrange
1449 | const value = 'LB30099900000001001925579115';
1450 |
1451 | // Act
1452 | const result = validator({ value });
1453 |
1454 | // Assert
1455 | expect(result).toEqual({
1456 | succeeded: true,
1457 | message: '',
1458 | type: VALIDATOR_TYPE,
1459 | });
1460 | });
1461 |
1462 | it('should return failed validation when it feeds value equals invalid IBAN from (Lebanon)', () => {
1463 | // Arrange
1464 | const value = 'LB30099900000001001925579114';
1465 |
1466 | // Act
1467 | const result = validator({ value });
1468 |
1469 | // Assert
1470 | expect(result).toEqual({
1471 | succeeded: false,
1472 | message: defaultMessage,
1473 | type: VALIDATOR_TYPE,
1474 | });
1475 | });
1476 |
1477 | // ** Liechtenstein
1478 | it('should return succeded validation when it feeds value equals valid IBAN from (Liechtenstein)', () => {
1479 | // Arrange
1480 | const value = 'LI21088100002324013AA';
1481 |
1482 | // Act
1483 | const result = validator({ value });
1484 |
1485 | // Assert
1486 | expect(result).toEqual({
1487 | succeeded: true,
1488 | message: '',
1489 | type: VALIDATOR_TYPE,
1490 | });
1491 | });
1492 |
1493 | it('should return failed validation when it feeds value equals invalid IBAN from (Liechtenstein)', () => {
1494 | // Arrange
1495 | const value = 'LI21088100002324013BA';
1496 |
1497 | // Act
1498 | const result = validator({ value });
1499 |
1500 | // Assert
1501 | expect(result).toEqual({
1502 | succeeded: false,
1503 | message: defaultMessage,
1504 | type: VALIDATOR_TYPE,
1505 | });
1506 | });
1507 |
1508 | // ** Lithuania
1509 | it('should return succeded validation when it feeds value equals valid IBAN from (Lithuania)', () => {
1510 | // Arrange
1511 | const value = 'LT121000011101001000';
1512 |
1513 | // Act
1514 | const result = validator({ value });
1515 |
1516 | // Assert
1517 | expect(result).toEqual({
1518 | succeeded: true,
1519 | message: '',
1520 | type: VALIDATOR_TYPE,
1521 | });
1522 | });
1523 |
1524 | it('should return failed validation when it feeds value equals invalid IBAN from (Lithuania)', () => {
1525 | // Arrange
1526 | const value = 'LT121000011101002000';
1527 |
1528 | // Act
1529 | const result = validator({ value });
1530 |
1531 | // Assert
1532 | expect(result).toEqual({
1533 | succeeded: false,
1534 | message: defaultMessage,
1535 | type: VALIDATOR_TYPE,
1536 | });
1537 | });
1538 |
1539 | // ** Luxembourg
1540 | it('should return succeded validation when it feeds value equals valid IBAN from (Luxembourg)', () => {
1541 | // Arrange
1542 | const value = 'LU280019400644750000';
1543 |
1544 | // Act
1545 | const result = validator({ value });
1546 |
1547 | // Assert
1548 | expect(result).toEqual({
1549 | succeeded: true,
1550 | message: '',
1551 | type: VALIDATOR_TYPE,
1552 | });
1553 | });
1554 |
1555 | it('should return failed validation when it feeds value equals invalid IBAN from (Luxembourg)', () => {
1556 | // Arrange
1557 | const value = 'LU280019400634750000';
1558 |
1559 | // Act
1560 | const result = validator({ value });
1561 |
1562 | // Assert
1563 | expect(result).toEqual({
1564 | succeeded: false,
1565 | message: defaultMessage,
1566 | type: VALIDATOR_TYPE,
1567 | });
1568 | });
1569 |
1570 | // ** Macedonia
1571 | it('should return succeded validation when it feeds value equals valid IBAN from (Macedonia)', () => {
1572 | // Arrange
1573 | const value = 'MK07300000000042425';
1574 |
1575 | // Act
1576 | const result = validator({ value });
1577 |
1578 | // Assert
1579 | expect(result).toEqual({
1580 | succeeded: true,
1581 | message: '',
1582 | type: VALIDATOR_TYPE,
1583 | });
1584 | });
1585 |
1586 | it('should return failed validation when it feeds value equals invalid IBAN from (Macedonia)', () => {
1587 | // Arrange
1588 | const value = 'MK06300000000042425';
1589 |
1590 | // Act
1591 | const result = validator({ value });
1592 |
1593 | // Assert
1594 | expect(result).toEqual({
1595 | succeeded: false,
1596 | message: defaultMessage,
1597 | type: VALIDATOR_TYPE,
1598 | });
1599 | });
1600 |
1601 | // ** Madagascar
1602 | it('should return succeded validation when it feeds value equals valid IBAN from (Madagascar)', () => {
1603 | // Arrange
1604 | const value = 'MG4600005030010101914016056';
1605 |
1606 | // Act
1607 | const result = validator({ value });
1608 |
1609 | // Assert
1610 | expect(result).toEqual({
1611 | succeeded: true,
1612 | message: '',
1613 | type: VALIDATOR_TYPE,
1614 | });
1615 | });
1616 |
1617 | it('should return failed validation when it feeds value equals invalid IBAN from (Madagascar)', () => {
1618 | // Arrange
1619 | const value = 'MG4600005030010101814016056';
1620 |
1621 | // Act
1622 | const result = validator({ value });
1623 |
1624 | // Assert
1625 | expect(result).toEqual({
1626 | succeeded: false,
1627 | message: defaultMessage,
1628 | type: VALIDATOR_TYPE,
1629 | });
1630 | });
1631 |
1632 | // ** Malta
1633 | it('should return succeded validation when it feeds value equals valid IBAN from (Malta)', () => {
1634 | // Arrange
1635 | const value = 'MT84MALT011000012345MTLCAST001S';
1636 |
1637 | // Act
1638 | const result = validator({ value });
1639 |
1640 | // Assert
1641 | expect(result).toEqual({
1642 | succeeded: true,
1643 | message: '',
1644 | type: VALIDATOR_TYPE,
1645 | });
1646 | });
1647 |
1648 | it('should return failed validation when it feeds value equals invalid IBAN from (Malta)', () => {
1649 | // Arrange
1650 | const value = 'MT84MALT011000012345YTLCAST001S';
1651 |
1652 | // Act
1653 | const result = validator({ value });
1654 |
1655 | // Assert
1656 | expect(result).toEqual({
1657 | succeeded: false,
1658 | message: defaultMessage,
1659 | type: VALIDATOR_TYPE,
1660 | });
1661 | });
1662 |
1663 | // ** Mauritania
1664 | it('should return succeded validation when it feeds value equals valid IBAN from (Mauritania)', () => {
1665 | // Arrange
1666 | const value = 'MR1300012000010000002037372';
1667 |
1668 | // Act
1669 | const result = validator({ value });
1670 |
1671 | // Assert
1672 | expect(result).toEqual({
1673 | succeeded: true,
1674 | message: '',
1675 | type: VALIDATOR_TYPE,
1676 | });
1677 | });
1678 |
1679 | it('should return failed validation when it feeds value equals invalid IBAN from (Mauritania)', () => {
1680 | // Arrange
1681 | const value = 'MR1300012001010000002037372';
1682 |
1683 | // Act
1684 | const result = validator({ value });
1685 |
1686 | // Assert
1687 | expect(result).toEqual({
1688 | succeeded: false,
1689 | message: defaultMessage,
1690 | type: VALIDATOR_TYPE,
1691 | });
1692 | });
1693 |
1694 | // ** Mauritius
1695 | it('should return succeded validation when it feeds value equals valid IBAN from (Mauritius)', () => {
1696 | // Arrange
1697 | const value = 'MU17BOMM0101101030300200000MUR';
1698 |
1699 | // Act
1700 | const result = validator({ value });
1701 |
1702 | // Assert
1703 | expect(result).toEqual({
1704 | succeeded: true,
1705 | message: '',
1706 | type: VALIDATOR_TYPE,
1707 | });
1708 | });
1709 |
1710 | it('should return failed validation when it feeds value equals invalid IBAN from (Mauritius)', () => {
1711 | // Arrange
1712 | const value = 'MU17BOMM0101101030300200010MUR';
1713 |
1714 | // Act
1715 | const result = validator({ value });
1716 |
1717 | // Assert
1718 | expect(result).toEqual({
1719 | succeeded: false,
1720 | message: defaultMessage,
1721 | type: VALIDATOR_TYPE,
1722 | });
1723 | });
1724 |
1725 | // ** Mali
1726 | it('should return succeded validation when it feeds value equals valid IBAN from (Mali)', () => {
1727 | // Arrange
1728 | const value = 'ML03D00890170001002120000447';
1729 |
1730 | // Act
1731 | const result = validator({ value });
1732 |
1733 | // Assert
1734 | expect(result).toEqual({
1735 | succeeded: true,
1736 | message: '',
1737 | type: VALIDATOR_TYPE,
1738 | });
1739 | });
1740 |
1741 | it('should return failed validation when it feeds value equals invalid IBAN from (Mali)', () => {
1742 | // Arrange
1743 | const value = 'ML03D00890170001002120000347';
1744 |
1745 | // Act
1746 | const result = validator({ value });
1747 |
1748 | // Assert
1749 | expect(result).toEqual({
1750 | succeeded: false,
1751 | message: defaultMessage,
1752 | type: VALIDATOR_TYPE,
1753 | });
1754 | });
1755 |
1756 | // ** Moldova
1757 | it('should return succeded validation when it feeds value equals valid IBAN from (Moldova)', () => {
1758 | // Arrange
1759 | const value = 'MD24AG000225100013104168';
1760 |
1761 | // Act
1762 | const result = validator({ value });
1763 |
1764 | // Assert
1765 | expect(result).toEqual({
1766 | succeeded: true,
1767 | message: '',
1768 | type: VALIDATOR_TYPE,
1769 | });
1770 | });
1771 |
1772 | it('should return failed validation when it feeds value equals invalid IBAN from (Moldova)', () => {
1773 | // Arrange
1774 | const value = 'MD24AG000224100013104168';
1775 |
1776 | // Act
1777 | const result = validator({ value });
1778 |
1779 | // Assert
1780 | expect(result).toEqual({
1781 | succeeded: false,
1782 | message: defaultMessage,
1783 | type: VALIDATOR_TYPE,
1784 | });
1785 | });
1786 |
1787 | // ** Monaco
1788 | it('should return succeded validation when it feeds value equals valid IBAN from (Monaco)', () => {
1789 | // Arrange
1790 | const value = 'MC5813488000010051108001292';
1791 |
1792 | // Act
1793 | const result = validator({ value });
1794 |
1795 | // Assert
1796 | expect(result).toEqual({
1797 | succeeded: true,
1798 | message: '',
1799 | type: VALIDATOR_TYPE,
1800 | });
1801 | });
1802 |
1803 | it('should return failed validation when it feeds value equals invalid IBAN from (Monaco)', () => {
1804 | // Arrange
1805 | const value = 'MC5813478000010051108001292';
1806 |
1807 | // Act
1808 | const result = validator({ value });
1809 |
1810 | // Assert
1811 | expect(result).toEqual({
1812 | succeeded: false,
1813 | message: defaultMessage,
1814 | type: VALIDATOR_TYPE,
1815 | });
1816 | });
1817 |
1818 | // ** Montenegro
1819 | it('should return succeded validation when it feeds value equals valid IBAN from (Montenegro)', () => {
1820 | // Arrange
1821 | const value = 'ME25505000012345678951';
1822 |
1823 | // Act
1824 | const result = validator({ value });
1825 |
1826 | // Assert
1827 | expect(result).toEqual({
1828 | succeeded: true,
1829 | message: '',
1830 | type: VALIDATOR_TYPE,
1831 | });
1832 | });
1833 |
1834 | it('should return failed validation when it feeds value equals invalid IBAN from (Montenegro)', () => {
1835 | // Arrange
1836 | const value = 'ME24505000012345678951';
1837 |
1838 | // Act
1839 | const result = validator({ value });
1840 |
1841 | // Assert
1842 | expect(result).toEqual({
1843 | succeeded: false,
1844 | message: defaultMessage,
1845 | type: VALIDATOR_TYPE,
1846 | });
1847 | });
1848 |
1849 | // ** Mozambique
1850 | it('should return succeded validation when it feeds value equals valid IBAN from (Mozambique)', () => {
1851 | // Arrange
1852 | const value = 'MZ59000100000011834194157';
1853 |
1854 | // Act
1855 | const result = validator({ value });
1856 |
1857 | // Assert
1858 | expect(result).toEqual({
1859 | succeeded: true,
1860 | message: '',
1861 | type: VALIDATOR_TYPE,
1862 | });
1863 | });
1864 |
1865 | it('should return failed validation when it feeds value equals invalid IBAN from (Mozambique)', () => {
1866 | // Arrange
1867 | const value = 'MZ59000100000011734194157';
1868 |
1869 | // Act
1870 | const result = validator({ value });
1871 |
1872 | // Assert
1873 | expect(result).toEqual({
1874 | succeeded: false,
1875 | message: defaultMessage,
1876 | type: VALIDATOR_TYPE,
1877 | });
1878 | });
1879 |
1880 | // ** Netherlands
1881 | it('should return succeded validation when it feeds value equals valid IBAN from (Netherlands)', () => {
1882 | // Arrange
1883 | const value = 'NL91ABNA0417164300';
1884 |
1885 | // Act
1886 | const result = validator({ value });
1887 |
1888 | // Assert
1889 | expect(result).toEqual({
1890 | succeeded: true,
1891 | message: '',
1892 | type: VALIDATOR_TYPE,
1893 | });
1894 | });
1895 |
1896 | it('should return failed validation when it feeds value equals invalid IBAN from (Netherlands)', () => {
1897 | // Arrange
1898 | const value = 'NL91ABNA0417164301';
1899 |
1900 | // Act
1901 | const result = validator({ value });
1902 |
1903 | // Assert
1904 | expect(result).toEqual({
1905 | succeeded: false,
1906 | message: defaultMessage,
1907 | type: VALIDATOR_TYPE,
1908 | });
1909 | });
1910 |
1911 | // ** Norway
1912 | it('should return succeded validation when it feeds value equals valid IBAN from (Norway)', () => {
1913 | // Arrange
1914 | const value = 'NO9386011117947';
1915 |
1916 | // Act
1917 | const result = validator({ value });
1918 |
1919 | // Assert
1920 | expect(result).toEqual({
1921 | succeeded: true,
1922 | message: '',
1923 | type: VALIDATOR_TYPE,
1924 | });
1925 | });
1926 |
1927 | it('should return failed validation when it feeds value equals invalid IBAN from (Norway)', () => {
1928 | // Arrange
1929 | const value = 'NO9386011117937';
1930 |
1931 | // Act
1932 | const result = validator({ value });
1933 |
1934 | // Assert
1935 | expect(result).toEqual({
1936 | succeeded: false,
1937 | message: defaultMessage,
1938 | type: VALIDATOR_TYPE,
1939 | });
1940 | });
1941 |
1942 | // ** Pakistan
1943 | it('should return succeded validation when it feeds value equals valid IBAN from (Pakistan)', () => {
1944 | // Arrange
1945 | const value = 'PK24SCBL0000001171495101';
1946 |
1947 | // Act
1948 | const result = validator({ value });
1949 |
1950 | // Assert
1951 | expect(result).toEqual({
1952 | succeeded: true,
1953 | message: '',
1954 | type: VALIDATOR_TYPE,
1955 | });
1956 | });
1957 |
1958 | it('should return failed validation when it feeds value equals invalid IBAN from (Pakistan)', () => {
1959 | // Arrange
1960 | const value = 'PK24SCBL0000101171495101';
1961 |
1962 | // Act
1963 | const result = validator({ value });
1964 |
1965 | // Assert
1966 | expect(result).toEqual({
1967 | succeeded: false,
1968 | message: defaultMessage,
1969 | type: VALIDATOR_TYPE,
1970 | });
1971 | });
1972 |
1973 | // ** Palestine
1974 | it('should return succeded validation when it feeds value equals valid IBAN from (Palestine)', () => {
1975 | // Arrange
1976 | const value = 'PS92PALS000000000400123456702';
1977 |
1978 | // Act
1979 | const result = validator({ value });
1980 |
1981 | // Assert
1982 | expect(result).toEqual({
1983 | succeeded: true,
1984 | message: '',
1985 | type: VALIDATOR_TYPE,
1986 | });
1987 | });
1988 |
1989 | it('should return failed validation when it feeds value equals invalid IBAN from (Palestine)', () => {
1990 | // Arrange
1991 | const value = 'PS92PALS000000000400122456702';
1992 |
1993 | // Act
1994 | const result = validator({ value });
1995 |
1996 | // Assert
1997 | expect(result).toEqual({
1998 | succeeded: false,
1999 | message: defaultMessage,
2000 | type: VALIDATOR_TYPE,
2001 | });
2002 | });
2003 |
2004 | // ** Poland
2005 | it('should return succeded validation when it feeds value equals valid IBAN from (Poland)', () => {
2006 | // Arrange
2007 | const value = 'PL27114020040000300201355387';
2008 |
2009 | // Act
2010 | const result = validator({ value });
2011 |
2012 | // Assert
2013 | expect(result).toEqual({
2014 | succeeded: true,
2015 | message: '',
2016 | type: VALIDATOR_TYPE,
2017 | });
2018 | });
2019 |
2020 | it('should return failed validation when it feeds value equals invalid IBAN from (Poland)', () => {
2021 | // Arrange
2022 | const value = 'PL23114020040000300201355387';
2023 |
2024 | // Act
2025 | const result = validator({ value });
2026 |
2027 | // Assert
2028 | expect(result).toEqual({
2029 | succeeded: false,
2030 | message: defaultMessage,
2031 | type: VALIDATOR_TYPE,
2032 | });
2033 | });
2034 |
2035 | // ** Portugal
2036 | it('should return succeded validation when it feeds value equals valid IBAN from (Portugal)', () => {
2037 | // Arrange
2038 | const value = 'PT50000201231234567890154';
2039 |
2040 | // Act
2041 | const result = validator({ value });
2042 |
2043 | // Assert
2044 | expect(result).toEqual({
2045 | succeeded: true,
2046 | message: '',
2047 | type: VALIDATOR_TYPE,
2048 | });
2049 | });
2050 |
2051 | it('should return failed validation when it feeds value equals invalid IBAN from (Portugal)', () => {
2052 | // Arrange
2053 | const value = 'PT50000201231234567890153';
2054 |
2055 | // Act
2056 | const result = validator({ value });
2057 |
2058 | // Assert
2059 | expect(result).toEqual({
2060 | succeeded: false,
2061 | message: defaultMessage,
2062 | type: VALIDATOR_TYPE,
2063 | });
2064 | });
2065 |
2066 | // ** Qatar
2067 | it('should return succeded validation when it feeds value equals valid IBAN from (Qatar)', () => {
2068 | // Arrange
2069 | const value = 'QA58DOHB00001234567890ABCDEFG';
2070 |
2071 | // Act
2072 | const result = validator({ value });
2073 |
2074 | // Assert
2075 | expect(result).toEqual({
2076 | succeeded: true,
2077 | message: '',
2078 | type: VALIDATOR_TYPE,
2079 | });
2080 | });
2081 |
2082 | it('should return failed validation when it feeds value equals invalid IBAN from (Qatar)', () => {
2083 | // Arrange
2084 | const value = 'QA58EOHB00001234567890ABCDEFG';
2085 |
2086 | // Act
2087 | const result = validator({ value });
2088 |
2089 | // Assert
2090 | expect(result).toEqual({
2091 | succeeded: false,
2092 | message: defaultMessage,
2093 | type: VALIDATOR_TYPE,
2094 | });
2095 | });
2096 |
2097 | it('should return succeded validation when it feeds value equals valid IBAN from (Republic of Kosovo)', () => {
2098 | // Arrange
2099 |
2100 | const value = 'XK051212012345678906';
2101 |
2102 | // Act
2103 | const result = validator({ value });
2104 |
2105 | // Assert
2106 | expect(result).toEqual({
2107 | succeeded: true,
2108 | message: '',
2109 | type: VALIDATOR_TYPE,
2110 | });
2111 | });
2112 |
2113 | it('should return succeded validation when it feeds value equals valid IBAN from (Republic of Kosovo - second test)', () => {
2114 | // Arrange
2115 | const value = 'XK051000000000000053';
2116 |
2117 | // Act
2118 | const result = validator({ value });
2119 |
2120 | // Assert
2121 | expect(result).toEqual({
2122 | succeeded: true,
2123 | message: '',
2124 | type: VALIDATOR_TYPE,
2125 | });
2126 | });
2127 |
2128 | it('should return failed validation when it feeds value equals invalid IBAN from (Republic of Kosovo)', () => {
2129 | // Arrange
2130 | const value = 'XK051212012345678907';
2131 |
2132 | // Act
2133 | const result = validator({ value });
2134 |
2135 | // Assert
2136 | expect(result).toEqual({
2137 | succeeded: false,
2138 | message: defaultMessage,
2139 | type: VALIDATOR_TYPE,
2140 | });
2141 | });
2142 |
2143 | // ** Romania
2144 | it('should return succeded validation when it feeds value equals valid IBAN from (Romania)', () => {
2145 | // Arrange
2146 | const value = 'RO49AAAA1B31007593840000';
2147 |
2148 | // Act
2149 | const result = validator({ value });
2150 |
2151 | // Assert
2152 | expect(result).toEqual({
2153 | succeeded: true,
2154 | message: '',
2155 | type: VALIDATOR_TYPE,
2156 | });
2157 | });
2158 |
2159 | it('should return failed validation when it feeds value equals invalid IBAN from (Romania)', () => {
2160 | // Arrange
2161 | const value = 'RO49AABA1B31007593840000';
2162 |
2163 | // Act
2164 | const result = validator({ value });
2165 |
2166 | // Assert
2167 | expect(result).toEqual({
2168 | succeeded: false,
2169 | message: defaultMessage,
2170 | type: VALIDATOR_TYPE,
2171 | });
2172 | });
2173 |
2174 | // ** San Marino
2175 | it('should return succeded validation when it feeds value equals valid IBAN from (San Marino)', () => {
2176 | // Arrange
2177 | const value = 'SM86U0322509800000000270100';
2178 |
2179 | // Act
2180 | const result = validator({ value });
2181 |
2182 | // Assert
2183 | expect(result).toEqual({
2184 | succeeded: true,
2185 | message: '',
2186 | type: VALIDATOR_TYPE,
2187 | });
2188 | });
2189 |
2190 | it('should return failed validation when it feeds value equals invalid IBAN from (San Marino)', () => {
2191 | // Arrange
2192 | const value = 'SM86U0322509800000000275100';
2193 |
2194 | // Act
2195 | const result = validator({ value });
2196 |
2197 | // Assert
2198 | expect(result).toEqual({
2199 | succeeded: false,
2200 | message: defaultMessage,
2201 | type: VALIDATOR_TYPE,
2202 | });
2203 | });
2204 |
2205 | // ** Saudi Arabia
2206 | it('should return succeded validation when it feeds value equals valid IBAN from (Saudi Arabia)', () => {
2207 | // Arrange
2208 | const value = 'SA0380000000608010167519';
2209 |
2210 | // Act
2211 | const result = validator({ value });
2212 |
2213 | // Assert
2214 | expect(result).toEqual({
2215 | succeeded: true,
2216 | message: '',
2217 | type: VALIDATOR_TYPE,
2218 | });
2219 | });
2220 |
2221 | it('should return failed validation when it feeds value equals invalid IBAN from (Saudi Arabia)', () => {
2222 | // Arrange
2223 | const value = 'SA0380000000600010167519';
2224 |
2225 | // Act
2226 | const result = validator({ value });
2227 |
2228 | // Assert
2229 | expect(result).toEqual({
2230 | succeeded: false,
2231 | message: defaultMessage,
2232 | type: VALIDATOR_TYPE,
2233 | });
2234 | });
2235 |
2236 | // ** Senegal
2237 | it('should return succeded validation when it feeds value equals valid IBAN from (Senegal)', () => {
2238 | // Arrange
2239 | const value = 'SN12K00100152000025690007542';
2240 |
2241 | // Act
2242 | const result = validator({ value });
2243 |
2244 | // Assert
2245 | expect(result).toEqual({
2246 | succeeded: true,
2247 | message: '',
2248 | type: VALIDATOR_TYPE,
2249 | });
2250 | });
2251 |
2252 | it('should return failed validation when it feeds value equals invalid IBAN from (Senegal)', () => {
2253 | // Arrange
2254 | const value = 'SN12K00100152000025680007542';
2255 |
2256 | // Act
2257 | const result = validator({ value });
2258 |
2259 | // Assert
2260 | expect(result).toEqual({
2261 | succeeded: false,
2262 | message: defaultMessage,
2263 | type: VALIDATOR_TYPE,
2264 | });
2265 | });
2266 |
2267 | // ** Serbia
2268 | it('should return succeded validation when it feeds value equals valid IBAN from (Serbia)', () => {
2269 | // Arrange
2270 | const value = 'RS35260005601001611379';
2271 |
2272 | // Act
2273 | const result = validator({ value });
2274 |
2275 | // Assert
2276 | expect(result).toEqual({
2277 | succeeded: true,
2278 | message: '',
2279 | type: VALIDATOR_TYPE,
2280 | });
2281 | });
2282 |
2283 | it('should return failed validation when it feeds value equals invalid IBAN from (Serbia)', () => {
2284 | // Arrange
2285 | const value = 'RS35260005601101611379';
2286 |
2287 | // Act
2288 | const result = validator({ value });
2289 |
2290 | // Assert
2291 | expect(result).toEqual({
2292 | succeeded: false,
2293 | message: defaultMessage,
2294 | type: VALIDATOR_TYPE,
2295 | });
2296 | });
2297 |
2298 | // ** Slovakia
2299 | it('should return succeded validation when it feeds value equals valid IBAN from (Slovakia)', () => {
2300 | // Arrange
2301 | const value = 'SK3112000000198742637541';
2302 |
2303 | // Act
2304 | const result = validator({ value });
2305 |
2306 | // Assert
2307 | expect(result).toEqual({
2308 | succeeded: true,
2309 | message: '',
2310 | type: VALIDATOR_TYPE,
2311 | });
2312 | });
2313 |
2314 | it('should return failed validation when it feeds value equals invalid IBAN from (Slovakia)', () => {
2315 | // Arrange
2316 | const value = 'SK2112000000198742637541';
2317 |
2318 | // Act
2319 | const result = validator({ value });
2320 |
2321 | // Assert
2322 | expect(result).toEqual({
2323 | succeeded: false,
2324 | message: defaultMessage,
2325 | type: VALIDATOR_TYPE,
2326 | });
2327 | });
2328 |
2329 | // ** Slovenia
2330 | it('should return succeded validation when it feeds value equals valid IBAN from (Slovenia)', () => {
2331 | // Arrange
2332 | const value = 'SI56191000000123438';
2333 |
2334 | // Act
2335 | const result = validator({ value });
2336 |
2337 | // Assert
2338 | expect(result).toEqual({
2339 | succeeded: true,
2340 | message: '',
2341 | type: VALIDATOR_TYPE,
2342 | });
2343 | });
2344 |
2345 | it('should return failed validation when it feeds value equals invalid IBAN from (Slovenia)', () => {
2346 | // Arrange
2347 | const value = 'SI56191000000223438';
2348 |
2349 | // Act
2350 | const result = validator({ value });
2351 |
2352 | // Assert
2353 | expect(result).toEqual({
2354 | succeeded: false,
2355 | message: defaultMessage,
2356 | type: VALIDATOR_TYPE,
2357 | });
2358 | });
2359 |
2360 | // ** Spain
2361 | it('should return succeded validation when it feeds value equals valid IBAN from (Spain)', () => {
2362 | // Arrange
2363 | const value = 'ES7921000813610123456789';
2364 |
2365 | // Act
2366 | const result = validator({ value });
2367 |
2368 | // Assert
2369 | expect(result).toEqual({
2370 | succeeded: true,
2371 | message: '',
2372 | type: VALIDATOR_TYPE,
2373 | });
2374 | });
2375 |
2376 | it('should return failed validation when it feeds value equals invalid IBAN from (Spain)', () => {
2377 | // Arrange
2378 | const value = 'ES7921000813615123456789';
2379 |
2380 | // Act
2381 | const result = validator({ value });
2382 |
2383 | // Assert
2384 | expect(result).toEqual({
2385 | succeeded: false,
2386 | message: defaultMessage,
2387 | type: VALIDATOR_TYPE,
2388 | });
2389 | });
2390 |
2391 | // ** Sweden
2392 | it('should return succeded validation when it feeds value equals valid IBAN from (Sweden)', () => {
2393 | // Arrange
2394 | const value = 'SE3550000000054910000003';
2395 |
2396 | // Act
2397 | const result = validator({ value });
2398 |
2399 | // Assert
2400 | expect(result).toEqual({
2401 | succeeded: true,
2402 | message: '',
2403 | type: VALIDATOR_TYPE,
2404 | });
2405 | });
2406 |
2407 | it('should return failed validation when it feeds value equals invalid IBAN from (Sweden)', () => {
2408 | // Arrange
2409 | const value = 'SE3550000000154910000003';
2410 |
2411 | // Act
2412 | const result = validator({ value });
2413 |
2414 | // Assert
2415 | expect(result).toEqual({
2416 | succeeded: false,
2417 | message: defaultMessage,
2418 | type: VALIDATOR_TYPE,
2419 | });
2420 | });
2421 |
2422 | // ** Switzerland
2423 | it('should return succeded validation when it feeds value equals valid IBAN from (Switzerland)', () => {
2424 | // Arrange
2425 | const value = 'CH9300762011623852957';
2426 |
2427 | // Act
2428 | const result = validator({ value });
2429 |
2430 | // Assert
2431 | expect(result).toEqual({
2432 | succeeded: true,
2433 | message: '',
2434 | type: VALIDATOR_TYPE,
2435 | });
2436 | });
2437 |
2438 | it('should return failed validation when it feeds value equals invalid IBAN from (Switzerland)', () => {
2439 | // Arrange
2440 | const value = 'CH9300762011623852857';
2441 |
2442 | // Act
2443 | const result = validator({ value });
2444 |
2445 | // Assert
2446 | expect(result).toEqual({
2447 | succeeded: false,
2448 | message: defaultMessage,
2449 | type: VALIDATOR_TYPE,
2450 | });
2451 | });
2452 |
2453 | // ** Tunisia
2454 | it('should return succeded validation when it feeds value equals valid IBAN from (Tunisia)', () => {
2455 | // Arrange
2456 | const value = 'TN5914207207100707129648';
2457 |
2458 | // Act
2459 | const result = validator({ value });
2460 |
2461 | // Assert
2462 | expect(result).toEqual({
2463 | succeeded: true,
2464 | message: '',
2465 | type: VALIDATOR_TYPE,
2466 | });
2467 | });
2468 |
2469 | it('should return failed validation when it feeds value equals invalid IBAN from (Tunisia)', () => {
2470 | // Arrange
2471 | const value = 'TN5914207207100707329648';
2472 |
2473 | // Act
2474 | const result = validator({ value });
2475 |
2476 | // Assert
2477 | expect(result).toEqual({
2478 | succeeded: false,
2479 | message: defaultMessage,
2480 | type: VALIDATOR_TYPE,
2481 | });
2482 | });
2483 |
2484 | // ** Turkey
2485 | it('should return succeded validation when it feeds value equals valid IBAN from (Turkey)', () => {
2486 | // Arrange
2487 | const value = 'TR330006100519786457841326';
2488 |
2489 | // Act
2490 | const result = validator({ value });
2491 |
2492 | // Assert
2493 | expect(result).toEqual({
2494 | succeeded: true,
2495 | message: '',
2496 | type: VALIDATOR_TYPE,
2497 | });
2498 | });
2499 |
2500 | it('should return failed validation when it feeds value equals invalid IBAN from (Turkey)', () => {
2501 | // Arrange
2502 | const value = 'TR330006100519786557841326';
2503 |
2504 | // Act
2505 | const result = validator({ value });
2506 |
2507 | // Assert
2508 | expect(result).toEqual({
2509 | succeeded: false,
2510 | message: defaultMessage,
2511 | type: VALIDATOR_TYPE,
2512 | });
2513 | });
2514 |
2515 | // ** United Arab Emirates
2516 | it('should return succeded validation when it feeds value equals valid IBAN from (United Arab Emirates)', () => {
2517 | // Arrange
2518 | const value = 'AE260211000000230064016';
2519 |
2520 | // Act
2521 | const result = validator({ value });
2522 |
2523 | // Assert
2524 | expect(result).toEqual({
2525 | succeeded: true,
2526 | message: '',
2527 | type: VALIDATOR_TYPE,
2528 | });
2529 | });
2530 |
2531 | it('should return failed validation when it feeds value equals invalid IBAN from (United Arab Emirates)', () => {
2532 | // Arrange
2533 | const value = 'AE260261000000230064016';
2534 |
2535 | // Act
2536 | const result = validator({ value });
2537 |
2538 | // Assert
2539 | expect(result).toEqual({
2540 | succeeded: false,
2541 | message: defaultMessage,
2542 | type: VALIDATOR_TYPE,
2543 | });
2544 | });
2545 |
2546 | // ** United Kingdom
2547 | it('should return succeded validation when it feeds value equals valid IBAN from (United Kingdom)', () => {
2548 | // Arrange
2549 | const value = 'GB29NWBK60161331926819';
2550 |
2551 | // Act
2552 | const result = validator({ value });
2553 |
2554 | // Assert
2555 | expect(result).toEqual({
2556 | succeeded: true,
2557 | message: '',
2558 | type: VALIDATOR_TYPE,
2559 | });
2560 | });
2561 |
2562 | it('should return failed validation when it feeds value equals invalid IBAN from (United Kingdom)', () => {
2563 | // Arrange
2564 | const value = 'GB29NWBK60161331326819';
2565 |
2566 | // Act
2567 | const result = validator({ value });
2568 |
2569 | // Assert
2570 | expect(result).toEqual({
2571 | succeeded: false,
2572 | message: defaultMessage,
2573 | type: VALIDATOR_TYPE,
2574 | });
2575 | });
2576 |
2577 | // ** Virgin Islands, British VG
2578 | it('should return succeded validation when it feeds value equals valid IBAN from (Virgin Islands, British VG)', () => {
2579 | // Arrange
2580 | const value = 'VG96VPVG0000012345678901';
2581 |
2582 | // Act
2583 | const result = validator({ value });
2584 |
2585 | // Assert
2586 | expect(result).toEqual({
2587 | succeeded: true,
2588 | message: '',
2589 | type: VALIDATOR_TYPE,
2590 | });
2591 | });
2592 |
2593 | it('should return failed validation when it feeds value equals invalid IBAN from (Virgin Islands, British VG)', () => {
2594 | // Arrange
2595 | const value = 'VG96VYVG0000012345678901';
2596 |
2597 | // Act
2598 | const result = validator({ value });
2599 |
2600 | // Assert
2601 | expect(result).toEqual({
2602 | succeeded: false,
2603 | message: defaultMessage,
2604 | type: VALIDATOR_TYPE,
2605 | });
2606 | });
2607 |
2608 | it('should overwrite default message when it feeds value and calls to setErrorMessage', () => {
2609 | // Arrange
2610 | const value = 'test';
2611 |
2612 | setErrorMessage('other message');
2613 |
2614 | // Act
2615 | const result = validator({ value });
2616 |
2617 | // Assert
2618 | expect(result).toEqual({
2619 | succeeded: false,
2620 | message: 'other message',
2621 | type: VALIDATOR_TYPE,
2622 | });
2623 | });
2624 | });
2625 |
--------------------------------------------------------------------------------
/src/validator.business.spec.ts:
--------------------------------------------------------------------------------
1 | import {
2 | sanitizeValue,
3 | hasIbanPattern,
4 | hasValidLength,
5 | } from './validator.business';
6 |
7 | describe('validator.business specs', () => {
8 | describe('sanitizeValue', () => {
9 | it('should return string without spaces and upper case when it feeds string equals "test"', () => {
10 | // Arrange
11 | const value = 'test';
12 |
13 | // Act
14 | const result = sanitizeValue(value);
15 |
16 | // Assert
17 | expect(result).toEqual('TEST');
18 | });
19 |
20 | it('should return string without spaces and upper case when it feeds string equals " t e s t "', () => {
21 | // Arrange
22 | const value = ' t e s t ';
23 |
24 | // Act
25 | const result = sanitizeValue(value);
26 |
27 | // Assert
28 | expect(result).toEqual('TEST');
29 | });
30 |
31 | it('should return string without spaces and upper case when it feeds string equals " t e s t 1 2 3 test"', () => {
32 | // Arrange
33 | const value = ' t e s t 1 2 3 test';
34 |
35 | // Act
36 | const result = sanitizeValue(value);
37 |
38 | // Assert
39 | expect(result).toEqual('TEST123TEST');
40 | });
41 | });
42 |
43 | describe('hasIbanPattern', () => {
44 | it('should return false when it feeds value with only numbers', () => {
45 | // Arrange
46 | const value = '12345';
47 |
48 | // Act
49 | const result = hasIbanPattern(value);
50 |
51 | // Assert
52 | expect(result).toBeFalsy();
53 | });
54 |
55 | it('should return true when it feeds value with only chars', () => {
56 | // Arrange
57 | const value = 'test';
58 |
59 | // Act
60 | const result = hasIbanPattern(value);
61 |
62 | // Assert
63 | expect(result).toBeTruthy();
64 | });
65 |
66 | it('should return false when it feeds value with two first chars equals number and rest string', () => {
67 | // Arrange
68 | const value = '12test';
69 |
70 | // Act
71 | const result = hasIbanPattern(value);
72 |
73 | // Assert
74 | expect(result).toBeFalsy();
75 | });
76 |
77 | it('should return true when it feeds value with two first chars equals lower case string and rest numbers', () => {
78 | // Arrange
79 | const value = 'ab1234';
80 |
81 | // Act
82 | const result = hasIbanPattern(value);
83 |
84 | // Assert
85 | expect(result).toBeTruthy();
86 | });
87 |
88 | it('should return true when it feeds value with two first chars equals upper case string and rest numbers', () => {
89 | // Arrange
90 | const value = 'AB1234';
91 |
92 | // Act
93 | const result = hasIbanPattern(value);
94 |
95 | // Assert
96 | expect(result).toBeTruthy();
97 | });
98 |
99 | it('should return false when it feeds value with non alpha-numeric chars', () => {
100 | // Arrange
101 | const value = '-*/?¿';
102 |
103 | // Act
104 | const result = hasIbanPattern(value);
105 |
106 | // Assert
107 | expect(result).toBeFalsy();
108 | });
109 |
110 | it('should return false when it feeds value with two first chars equals upper case string and rest numbers and non alpha-numeric char', () => {
111 | // Arrange
112 | const value = 'AB1234/';
113 |
114 | // Act
115 | const result = hasIbanPattern(value);
116 |
117 | // Assert
118 | expect(result).toBeFalsy();
119 | });
120 | });
121 |
122 | describe('hasValidLength', () => {
123 | it('should return false when it feeds value with only numbers', () => {
124 | // Arrange
125 | const value = '12345';
126 |
127 | // Act
128 | const result = hasValidLength(value);
129 |
130 | // Assert
131 | expect(result).toBeFalsy();
132 | });
133 |
134 | it('should return false when it feeds value with numbers and string at the end', () => {
135 | // Arrange
136 | const value = '12345ES';
137 |
138 | // Act
139 | const result = hasValidLength(value);
140 |
141 | // Assert
142 | expect(result).toBeFalsy();
143 | });
144 |
145 | it('should return false when it feeds value with invalid country code first and then numbers', () => {
146 | // Arrange
147 | const value = 'XX1234';
148 |
149 | // Act
150 | const result = hasValidLength(value);
151 |
152 | // Assert
153 | expect(result).toBeFalsy();
154 | });
155 |
156 | it('should return false when it feeds value with invalid country code first and then numbers and string', () => {
157 | // Arrange
158 | const value = 'XX1234AB';
159 |
160 | // Act
161 | const result = hasValidLength(value);
162 |
163 | // Assert
164 | expect(result).toBeFalsy();
165 | });
166 |
167 | it('should return true when it feeds value with valid country code (AD) first and then numbers and string with length equals 24', () => {
168 | // Arrange
169 | const value = 'AD12345678901234567890AB';
170 |
171 | // Act
172 | const result = hasValidLength(value);
173 |
174 | // Assert
175 | expect(result).toBeTruthy();
176 | });
177 |
178 | it('should return false when it feeds value with valid country code (AD) first and then numbers and string with length greater than 24', () => {
179 | // Arrange
180 | const value = 'AD12345678901234567890AB1';
181 |
182 | // Act
183 | const result = hasValidLength(value);
184 |
185 | // Assert
186 | expect(result).toBeFalsy();
187 | });
188 |
189 | it('should return false when it feeds value with valid country code (AD) first and then numbers and string with length lower than 24', () => {
190 | // Arrange
191 | const value = 'AD12345678901234567890A';
192 |
193 | // Act
194 | const result = hasValidLength(value);
195 |
196 | // Assert
197 | expect(result).toBeFalsy();
198 | });
199 |
200 | it('should return true when it feeds value with valid country code (AE) first and then numbers and string with length equals 23', () => {
201 | // Arrange
202 | const value = 'AE1234567890123456789AB';
203 |
204 | // Act
205 | const result = hasValidLength(value);
206 |
207 | // Assert
208 | expect(result).toBeTruthy();
209 | });
210 |
211 | it('should return false when it feeds value with valid country code (AE) first and then numbers and string with length greater than 23', () => {
212 | // Arrange
213 | const value = 'AE1234567890123456789AB1';
214 |
215 | // Act
216 | const result = hasValidLength(value);
217 |
218 | // Assert
219 | expect(result).toBeFalsy();
220 | });
221 |
222 | it('should return false when it feeds value with valid country code (AE) first and then numbers and string with length lower than 23', () => {
223 | // Arrange
224 | const value = 'AE1234567890123456789A';
225 |
226 | // Act
227 | const result = hasValidLength(value);
228 |
229 | // Assert
230 | expect(result).toBeFalsy();
231 | });
232 |
233 | it('should return true when it feeds value with valid country code (AL) first and then numbers and string with length equals 28', () => {
234 | // Arrange
235 | const value = 'AL123456789012345678901234AB';
236 |
237 | // Act
238 | const result = hasValidLength(value);
239 |
240 | // Assert
241 | expect(result).toBeTruthy();
242 | });
243 |
244 | it('should return false when it feeds value with valid country code (AL) first and then numbers and string with length greater than 28', () => {
245 | // Arrange
246 | const value = 'AL123456789012345678901234AB1';
247 |
248 | // Act
249 | const result = hasValidLength(value);
250 |
251 | // Assert
252 | expect(result).toBeFalsy();
253 | });
254 |
255 | it('should return false when it feeds value with valid country code (AL) first and then numbers and string with length lower than 28', () => {
256 | // Arrange
257 | const value = 'AL123456789012345678901234A';
258 |
259 | // Act
260 | const result = hasValidLength(value);
261 |
262 | // Assert
263 | expect(result).toBeFalsy();
264 | });
265 |
266 | it('should return true when it feeds value with valid country code (AO) first and then numbers and string with length equals 25', () => {
267 | // Arrange
268 | const value = 'AO123456789012345678901AB';
269 |
270 | // Act
271 | const result = hasValidLength(value);
272 |
273 | // Assert
274 | expect(result).toBeTruthy();
275 | });
276 |
277 | it('should return false when it feeds value with valid country code (AO) first and then numbers and string with length greater than 25', () => {
278 | // Arrange
279 | const value = 'AO123456789012345678901AB1';
280 |
281 | // Act
282 | const result = hasValidLength(value);
283 |
284 | // Assert
285 | expect(result).toBeFalsy();
286 | });
287 |
288 | it('should return false when it feeds value with valid country code (AO) first and then numbers and string with length lower than 25', () => {
289 | // Arrange
290 | const value = 'AO123456789012345678901A';
291 |
292 | // Act
293 | const result = hasValidLength(value);
294 |
295 | // Assert
296 | expect(result).toBeFalsy();
297 | });
298 |
299 | it('should return true when it feeds value with valid country code (AT) first and then numbers and string with length equals 20', () => {
300 | // Arrange
301 | const value = 'AT1234567890123456AB';
302 |
303 | // Act
304 | const result = hasValidLength(value);
305 |
306 | // Assert
307 | expect(result).toBeTruthy();
308 | });
309 |
310 | it('should return false when it feeds value with valid country code (AT) first and then numbers and string with length greater than 20', () => {
311 | // Arrange
312 | const value = 'AT1234567890123456AB1';
313 |
314 | // Act
315 | const result = hasValidLength(value);
316 |
317 | // Assert
318 | expect(result).toBeFalsy();
319 | });
320 |
321 | it('should return false when it feeds value with valid country code (AT) first and then numbers and string with length lower than 20', () => {
322 | // Arrange
323 | const value = 'AT1234567890123456A';
324 |
325 | // Act
326 | const result = hasValidLength(value);
327 |
328 | // Assert
329 | expect(result).toBeFalsy();
330 | });
331 |
332 | it('should return true when it feeds value with valid country code (AZ) first and then numbers and string with length equals 28', () => {
333 | // Arrange
334 | const value = 'AZ123456789012345678901234AB';
335 |
336 | // Act
337 | const result = hasValidLength(value);
338 |
339 | // Assert
340 | expect(result).toBeTruthy();
341 | });
342 |
343 | it('should return false when it feeds value with valid country code (AZ) first and then numbers and string with length greater than 28', () => {
344 | // Arrange
345 | const value = 'AZ123456789012345678901234AB1';
346 |
347 | // Act
348 | const result = hasValidLength(value);
349 |
350 | // Assert
351 | expect(result).toBeFalsy();
352 | });
353 |
354 | it('should return false when it feeds value with valid country code (AZ) first and then numbers and string with length lower than 28', () => {
355 | // Arrange
356 | const value = 'AZ123456789012345678901234A';
357 |
358 | // Act
359 | const result = hasValidLength(value);
360 |
361 | // Assert
362 | expect(result).toBeFalsy();
363 | });
364 |
365 | it('should return true when it feeds value with valid country code (BA) first and then numbers and string with length equals 20', () => {
366 | // Arrange
367 | const value = 'BA1234567890123456AB';
368 |
369 | // Act
370 | const result = hasValidLength(value);
371 |
372 | // Assert
373 | expect(result).toBeTruthy();
374 | });
375 |
376 | it('should return false when it feeds value with valid country code (BA) first and then numbers and string with length greater than 20', () => {
377 | // Arrange
378 | const value = 'BA1234567890123456AB1';
379 |
380 | // Act
381 | const result = hasValidLength(value);
382 |
383 | // Assert
384 | expect(result).toBeFalsy();
385 | });
386 |
387 | it('should return false when it feeds value with valid country code (BA) first and then numbers and string with length lower than 20', () => {
388 | // Arrange
389 | const value = 'BA1234567890123456A';
390 |
391 | // Act
392 | const result = hasValidLength(value);
393 |
394 | // Assert
395 | expect(result).toBeFalsy();
396 | });
397 |
398 | it('should return true when it feeds value with valid country code (BE) first and then numbers and string with length equals 16', () => {
399 | // Arrange
400 | const value = 'BE123456789012AB';
401 |
402 | // Act
403 | const result = hasValidLength(value);
404 |
405 | // Assert
406 | expect(result).toBeTruthy();
407 | });
408 |
409 | it('should return false when it feeds value with valid country code (BE) first and then numbers and string with length greater than 16', () => {
410 | // Arrange
411 | const value = 'BE123456789012AB1';
412 |
413 | // Act
414 | const result = hasValidLength(value);
415 |
416 | // Assert
417 | expect(result).toBeFalsy();
418 | });
419 |
420 | it('should return false when it feeds value with valid country code (BE) first and then numbers and string with length lower than 16', () => {
421 | // Arrange
422 | const value = 'BE123456789012A';
423 |
424 | // Act
425 | const result = hasValidLength(value);
426 |
427 | // Assert
428 | expect(result).toBeFalsy();
429 | });
430 |
431 | it('should return true when it feeds value with valid country code (BF) first and then numbers and string with length equals 27', () => {
432 | // Arrange
433 | const value = 'BF12345678901234567890123AB';
434 |
435 | // Act
436 | const result = hasValidLength(value);
437 |
438 | // Assert
439 | expect(result).toBeTruthy();
440 | });
441 |
442 | it('should return false when it feeds value with valid country code (BF) first and then numbers and string with length greater than 27', () => {
443 | // Arrange
444 | const value = 'BF12345678901234567890123AB1';
445 |
446 | // Act
447 | const result = hasValidLength(value);
448 |
449 | // Assert
450 | expect(result).toBeFalsy();
451 | });
452 |
453 | it('should return false when it feeds value with valid country code (BF) first and then numbers and string with length lower than 27', () => {
454 | // Arrange
455 | const value = 'BF12345678901234567890123A';
456 |
457 | // Act
458 | const result = hasValidLength(value);
459 |
460 | // Assert
461 | expect(result).toBeFalsy();
462 | });
463 |
464 | it('should return true when it feeds value with valid country code (BG) first and then numbers and string with length equals 22', () => {
465 | // Arrange
466 | const value = 'BG123456789012345678AB';
467 |
468 | // Act
469 | const result = hasValidLength(value);
470 |
471 | // Assert
472 | expect(result).toBeTruthy();
473 | });
474 |
475 | it('should return false when it feeds value with valid country code (BG) first and then numbers and string with length greater than 22', () => {
476 | // Arrange
477 | const value = 'BG123456789012345678AB1';
478 |
479 | // Act
480 | const result = hasValidLength(value);
481 |
482 | // Assert
483 | expect(result).toBeFalsy();
484 | });
485 |
486 | it('should return false when it feeds value with valid country code (BG) first and then numbers and string with length lower than 22', () => {
487 | // Arrange
488 | const value = 'BG123456789012345678A';
489 |
490 | // Act
491 | const result = hasValidLength(value);
492 |
493 | // Assert
494 | expect(result).toBeFalsy();
495 | });
496 |
497 | it('should return true when it feeds value with valid country code (BH) first and then numbers and string with length equals 22', () => {
498 | // Arrange
499 | const value = 'BH123456789012345678AB';
500 |
501 | // Act
502 | const result = hasValidLength(value);
503 |
504 | // Assert
505 | expect(result).toBeTruthy();
506 | });
507 |
508 | it('should return false when it feeds value with valid country code (BH) first and then numbers and string with length greater than 22', () => {
509 | // Arrange
510 | const value = 'BH123456789012345678AB1';
511 |
512 | // Act
513 | const result = hasValidLength(value);
514 |
515 | // Assert
516 | expect(result).toBeFalsy();
517 | });
518 |
519 | it('should return false when it feeds value with valid country code (BH) first and then numbers and string with length lower than 22', () => {
520 | // Arrange
521 | const value = 'BH123456789012345678A';
522 |
523 | // Act
524 | const result = hasValidLength(value);
525 |
526 | // Assert
527 | expect(result).toBeFalsy();
528 | });
529 |
530 | it('should return true when it feeds value with valid country code (BI) first and then numbers and string with length equals 16', () => {
531 | // Arrange
532 | const value = 'BI123456789012AB';
533 |
534 | // Act
535 | const result = hasValidLength(value);
536 |
537 | // Assert
538 | expect(result).toBeTruthy();
539 | });
540 |
541 | it('should return false when it feeds value with valid country code (BI) first and then numbers and string with length greater than 16', () => {
542 | // Arrange
543 | const value = 'BI123456789012AB1';
544 |
545 | // Act
546 | const result = hasValidLength(value);
547 |
548 | // Assert
549 | expect(result).toBeFalsy();
550 | });
551 |
552 | it('should return false when it feeds value with valid country code (BI) first and then numbers and string with length lower than 16', () => {
553 | // Arrange
554 | const value = 'BI123456789012A';
555 |
556 | // Act
557 | const result = hasValidLength(value);
558 |
559 | // Assert
560 | expect(result).toBeFalsy();
561 | });
562 |
563 | it('should return true when it feeds value with valid country code (BJ) first and then numbers and string with length equals 28', () => {
564 | // Arrange
565 | const value = 'BJ123456789012345678901234AB';
566 |
567 | // Act
568 | const result = hasValidLength(value);
569 |
570 | // Assert
571 | expect(result).toBeTruthy();
572 | });
573 |
574 | it('should return false when it feeds value with valid country code (BJ) first and then numbers and string with length greater than 28', () => {
575 | // Arrange
576 | const value = 'BJ123456789012345678901234AB1';
577 |
578 | // Act
579 | const result = hasValidLength(value);
580 |
581 | // Assert
582 | expect(result).toBeFalsy();
583 | });
584 |
585 | it('should return false when it feeds value with valid country code (BJ) first and then numbers and string with length lower than 28', () => {
586 | // Arrange
587 | const value = 'BJ123456789012345678901234A';
588 |
589 | // Act
590 | const result = hasValidLength(value);
591 |
592 | // Assert
593 | expect(result).toBeFalsy();
594 | });
595 |
596 | it('should return true when it feeds value with valid country code (BR) first and then numbers and string with length equals 29', () => {
597 | // Arrange
598 | const value = 'BR1234567890123456789012345AB';
599 |
600 | // Act
601 | const result = hasValidLength(value);
602 |
603 | // Assert
604 | expect(result).toBeTruthy();
605 | });
606 |
607 | it('should return false when it feeds value with valid country code (BR) first and then numbers and string with length greater than 29', () => {
608 | // Arrange
609 | const value = 'BR1234567890123456789012345AB1';
610 |
611 | // Act
612 | const result = hasValidLength(value);
613 |
614 | // Assert
615 | expect(result).toBeFalsy();
616 | });
617 |
618 | it('should return false when it feeds value with valid country code (BR) first and then numbers and string with length lower than 29', () => {
619 | // Arrange
620 | const value = 'BR1234567890123456789012345A';
621 |
622 | // Act
623 | const result = hasValidLength(value);
624 |
625 | // Assert
626 | expect(result).toBeFalsy();
627 | });
628 |
629 | it('should return true when it feeds value with valid country code (BY) first and then numbers and string with length equals 28', () => {
630 | // Arrange
631 | const value = 'BY123456789012345678901234AB';
632 |
633 | // Act
634 | const result = hasValidLength(value);
635 |
636 | // Assert
637 | expect(result).toBeTruthy();
638 | });
639 |
640 | it('should return false when it feeds value with valid country code (BY) first and then numbers and string with length greater than 28', () => {
641 | // Arrange
642 | const value = 'BY123456789012345678901234AB1';
643 |
644 | // Act
645 | const result = hasValidLength(value);
646 |
647 | // Assert
648 | expect(result).toBeFalsy();
649 | });
650 |
651 | it('should return false when it feeds value with valid country code (BY) first and then numbers and string with length lower than 28', () => {
652 | // Arrange
653 | const value = 'BY123456789012345678901234A';
654 |
655 | // Act
656 | const result = hasValidLength(value);
657 |
658 | // Assert
659 | expect(result).toBeFalsy();
660 | });
661 |
662 | it('should return true when it feeds value with valid country code (CH) first and then numbers and string with length equals 21', () => {
663 | // Arrange
664 | const value = 'CH12345678901234567AB';
665 |
666 | // Act
667 | const result = hasValidLength(value);
668 |
669 | // Assert
670 | expect(result).toBeTruthy();
671 | });
672 |
673 | it('should return false when it feeds value with valid country code (CH) first and then numbers and string with length greater than 21', () => {
674 | // Arrange
675 | const value = 'CH12345678901234567AB1';
676 |
677 | // Act
678 | const result = hasValidLength(value);
679 |
680 | // Assert
681 | expect(result).toBeFalsy();
682 | });
683 |
684 | it('should return false when it feeds value with valid country code (CH) first and then numbers and string with length lower than 21', () => {
685 | // Arrange
686 | const value = 'CH12345678901234567A';
687 |
688 | // Act
689 | const result = hasValidLength(value);
690 |
691 | // Assert
692 | expect(result).toBeFalsy();
693 | });
694 |
695 | it('should return true when it feeds value with valid country code (CI) first and then numbers and string with length equals 28', () => {
696 | // Arrange
697 | const value = 'CI123456789012345678901234AB';
698 |
699 | // Act
700 | const result = hasValidLength(value);
701 |
702 | // Assert
703 | expect(result).toBeTruthy();
704 | });
705 |
706 | it('should return false when it feeds value with valid country code (CI) first and then numbers and string with length greater than 28', () => {
707 | // Arrange
708 | const value = 'CI123456789012345678901234AB1';
709 |
710 | // Act
711 | const result = hasValidLength(value);
712 |
713 | // Assert
714 | expect(result).toBeFalsy();
715 | });
716 |
717 | it('should return false when it feeds value with valid country code (CI) first and then numbers and string with length lower than 28', () => {
718 | // Arrange
719 | const value = 'CI123456789012345678901234A';
720 |
721 | // Act
722 | const result = hasValidLength(value);
723 |
724 | // Assert
725 | expect(result).toBeFalsy();
726 | });
727 |
728 | it('should return true when it feeds value with valid country code (CM) first and then numbers and string with length equals 27', () => {
729 | // Arrange
730 | const value = 'CM12345678901234567890123AB';
731 |
732 | // Act
733 | const result = hasValidLength(value);
734 |
735 | // Assert
736 | expect(result).toBeTruthy();
737 | });
738 |
739 | it('should return false when it feeds value with valid country code (CM) first and then numbers and string with length greater than 27', () => {
740 | // Arrange
741 | const value = 'CM12345678901234567890123AB1';
742 |
743 | // Act
744 | const result = hasValidLength(value);
745 |
746 | // Assert
747 | expect(result).toBeFalsy();
748 | });
749 |
750 | it('should return false when it feeds value with valid country code (CM) first and then numbers and string with length lower than 27', () => {
751 | // Arrange
752 | const value = 'CM12345678901234567890123A';
753 |
754 | // Act
755 | const result = hasValidLength(value);
756 |
757 | // Assert
758 | expect(result).toBeFalsy();
759 | });
760 |
761 | it('should return true when it feeds value with valid country code (CR) first and then numbers and string with length equals 22', () => {
762 | // Arrange
763 | const value = 'CR123456789012345678AB';
764 |
765 | // Act
766 | const result = hasValidLength(value);
767 |
768 | // Assert
769 | expect(result).toBeTruthy();
770 | });
771 |
772 | it('should return false when it feeds value with valid country code (CR) first and then numbers and string with length greater than 22', () => {
773 | // Arrange
774 | const value = 'CR123456789012345678AB1';
775 |
776 | // Act
777 | const result = hasValidLength(value);
778 |
779 | // Assert
780 | expect(result).toBeFalsy();
781 | });
782 |
783 | it('should return false when it feeds value with valid country code (CR) first and then numbers and string with length lower than 22', () => {
784 | // Arrange
785 | const value = 'CR123456789012345678A';
786 |
787 | // Act
788 | const result = hasValidLength(value);
789 |
790 | // Assert
791 | expect(result).toBeFalsy();
792 | });
793 |
794 | it('should return true when it feeds value with valid country code (CV) first and then numbers and string with length equals 25', () => {
795 | // Arrange
796 | const value = 'CV123456789012345678901AB';
797 |
798 | // Act
799 | const result = hasValidLength(value);
800 |
801 | // Assert
802 | expect(result).toBeTruthy();
803 | });
804 |
805 | it('should return false when it feeds value with valid country code (CV) first and then numbers and string with length greater than 25', () => {
806 | // Arrange
807 | const value = 'CV123456789012345678901AB1';
808 |
809 | // Act
810 | const result = hasValidLength(value);
811 |
812 | // Assert
813 | expect(result).toBeFalsy();
814 | });
815 |
816 | it('should return false when it feeds value with valid country code (CV) first and then numbers and string with length lower than 25', () => {
817 | // Arrange
818 | const value = 'CV123456789012345678901A';
819 |
820 | // Act
821 | const result = hasValidLength(value);
822 |
823 | // Assert
824 | expect(result).toBeFalsy();
825 | });
826 |
827 | it('should return true when it feeds value with valid country code (CY) first and then numbers and string with length equals 28', () => {
828 | // Arrange
829 | const value = 'CY123456789012345678901234AB';
830 |
831 | // Act
832 | const result = hasValidLength(value);
833 |
834 | // Assert
835 | expect(result).toBeTruthy();
836 | });
837 |
838 | it('should return false when it feeds value with valid country code (CY) first and then numbers and string with length greater than 28', () => {
839 | // Arrange
840 | const value = 'CY123456789012345678901234AB1';
841 |
842 | // Act
843 | const result = hasValidLength(value);
844 |
845 | // Assert
846 | expect(result).toBeFalsy();
847 | });
848 |
849 | it('should return false when it feeds value with valid country code (CY) first and then numbers and string with length lower than 28', () => {
850 | // Arrange
851 | const value = 'CY123456789012345678901234A';
852 |
853 | // Act
854 | const result = hasValidLength(value);
855 |
856 | // Assert
857 | expect(result).toBeFalsy();
858 | });
859 |
860 | it('should return true when it feeds value with valid country code (CZ) first and then numbers and string with length equals 24', () => {
861 | // Arrange
862 | const value = 'CZ12345678901234567890AB';
863 |
864 | // Act
865 | const result = hasValidLength(value);
866 |
867 | // Assert
868 | expect(result).toBeTruthy();
869 | });
870 |
871 | it('should return false when it feeds value with valid country code (CZ) first and then numbers and string with length greater than 24', () => {
872 | // Arrange
873 | const value = 'CZ12345678901234567890AB1';
874 |
875 | // Act
876 | const result = hasValidLength(value);
877 |
878 | // Assert
879 | expect(result).toBeFalsy();
880 | });
881 |
882 | it('should return false when it feeds value with valid country code (CZ) first and then numbers and string with length lower than 24', () => {
883 | // Arrange
884 | const value = 'CZ12345678901234567890A';
885 |
886 | // Act
887 | const result = hasValidLength(value);
888 |
889 | // Assert
890 | expect(result).toBeFalsy();
891 | });
892 |
893 | it('should return true when it feeds value with valid country code (DE) first and then numbers and string with length equals 22', () => {
894 | // Arrange
895 | const value = 'DE123456789012345678AB';
896 |
897 | // Act
898 | const result = hasValidLength(value);
899 |
900 | // Assert
901 | expect(result).toBeTruthy();
902 | });
903 |
904 | it('should return false when it feeds value with valid country code (DE) first and then numbers and string with length greater than 22', () => {
905 | // Arrange
906 | const value = 'DE123456789012345678AB1';
907 |
908 | // Act
909 | const result = hasValidLength(value);
910 |
911 | // Assert
912 | expect(result).toBeFalsy();
913 | });
914 |
915 | it('should return false when it feeds value with valid country code (DE) first and then numbers and string with length lower than 22', () => {
916 | // Arrange
917 | const value = 'DE123456789012345678A';
918 |
919 | // Act
920 | const result = hasValidLength(value);
921 |
922 | // Assert
923 | expect(result).toBeFalsy();
924 | });
925 |
926 | it('should return true when it feeds value with valid country code (DK) first and then numbers and string with length equals 18', () => {
927 | // Arrange
928 | const value = 'DK12345678901234AB';
929 |
930 | // Act
931 | const result = hasValidLength(value);
932 |
933 | // Assert
934 | expect(result).toBeTruthy();
935 | });
936 |
937 | it('should return false when it feeds value with valid country code (DK) first and then numbers and string with length greater than 18', () => {
938 | // Arrange
939 | const value = 'DK12345678901234AB1';
940 |
941 | // Act
942 | const result = hasValidLength(value);
943 |
944 | // Assert
945 | expect(result).toBeFalsy();
946 | });
947 |
948 | it('should return false when it feeds value with valid country code (DK) first and then numbers and string with length lower than 18', () => {
949 | // Arrange
950 | const value = 'DK12345678901234A';
951 |
952 | // Act
953 | const result = hasValidLength(value);
954 |
955 | // Assert
956 | expect(result).toBeFalsy();
957 | });
958 |
959 | it('should return true when it feeds value with valid country code (DO) first and then numbers and string with length equals 28', () => {
960 | // Arrange
961 | const value = 'DO123456789012345678901234AB';
962 |
963 | // Act
964 | const result = hasValidLength(value);
965 |
966 | // Assert
967 | expect(result).toBeTruthy();
968 | });
969 |
970 | it('should return false when it feeds value with valid country code (DO) first and then numbers and string with length greater than 28', () => {
971 | // Arrange
972 | const value = 'DO123456789012345678901234AB1';
973 |
974 | // Act
975 | const result = hasValidLength(value);
976 |
977 | // Assert
978 | expect(result).toBeFalsy();
979 | });
980 |
981 | it('should return false when it feeds value with valid country code (DO) first and then numbers and string with length lower than 28', () => {
982 | // Arrange
983 | const value = 'DO123456789012345678901234A';
984 |
985 | // Act
986 | const result = hasValidLength(value);
987 |
988 | // Assert
989 | expect(result).toBeFalsy();
990 | });
991 |
992 | it('should return true when it feeds value with valid country code (DZ) first and then numbers and string with length equals 24', () => {
993 | // Arrange
994 | const value = 'DZ12345678901234567890AB';
995 |
996 | // Act
997 | const result = hasValidLength(value);
998 |
999 | // Assert
1000 | expect(result).toBeTruthy();
1001 | });
1002 |
1003 | it('should return false when it feeds value with valid country code (DZ) first and then numbers and string with length greater than 24', () => {
1004 | // Arrange
1005 | const value = 'DZ12345678901234567890AB1';
1006 |
1007 | // Act
1008 | const result = hasValidLength(value);
1009 |
1010 | // Assert
1011 | expect(result).toBeFalsy();
1012 | });
1013 |
1014 | it('should return false when it feeds value with valid country code (DZ) first and then numbers and string with length lower than 24', () => {
1015 | // Arrange
1016 | const value = 'DZ12345678901234567890A';
1017 |
1018 | // Act
1019 | const result = hasValidLength(value);
1020 |
1021 | // Assert
1022 | expect(result).toBeFalsy();
1023 | });
1024 |
1025 | it('should return true when it feeds value with valid country code (EE) first and then numbers and string with length equals 20', () => {
1026 | // Arrange
1027 | const value = 'EE1234567890123456AB';
1028 |
1029 | // Act
1030 | const result = hasValidLength(value);
1031 |
1032 | // Assert
1033 | expect(result).toBeTruthy();
1034 | });
1035 |
1036 | it('should return false when it feeds value with valid country code (EE) first and then numbers and string with length greater than 20', () => {
1037 | // Arrange
1038 | const value = 'EE1234567890123456AB1';
1039 |
1040 | // Act
1041 | const result = hasValidLength(value);
1042 |
1043 | // Assert
1044 | expect(result).toBeFalsy();
1045 | });
1046 |
1047 | it('should return false when it feeds value with valid country code (EE) first and then numbers and string with length lower than 20', () => {
1048 | // Arrange
1049 | const value = 'EE1234567890123456A';
1050 |
1051 | // Act
1052 | const result = hasValidLength(value);
1053 |
1054 | // Assert
1055 | expect(result).toBeFalsy();
1056 | });
1057 |
1058 | it('should return true when it feeds value with valid country code (ES) first and then numbers and string with length equals 24', () => {
1059 | // Arrange
1060 | const value = 'ES12345678901234567890AB';
1061 |
1062 | // Act
1063 | const result = hasValidLength(value);
1064 |
1065 | // Assert
1066 | expect(result).toBeTruthy();
1067 | });
1068 |
1069 | it('should return false when it feeds value with valid country code (ES) first and then numbers and string with length greater than 24', () => {
1070 | // Arrange
1071 | const value = 'ES12345678901234567890AB1';
1072 |
1073 | // Act
1074 | const result = hasValidLength(value);
1075 |
1076 | // Assert
1077 | expect(result).toBeFalsy();
1078 | });
1079 |
1080 | it('should return false when it feeds value with valid country code (ES) first and then numbers and string with length lower than 24', () => {
1081 | // Arrange
1082 | const value = 'ES12345678901234567890A';
1083 |
1084 | // Act
1085 | const result = hasValidLength(value);
1086 |
1087 | // Assert
1088 | expect(result).toBeFalsy();
1089 | });
1090 |
1091 | it('should return true when it feeds value with valid country code (FI) first and then numbers and string with length equals 18', () => {
1092 | // Arrange
1093 | const value = 'FI12345678901234AB';
1094 |
1095 | // Act
1096 | const result = hasValidLength(value);
1097 |
1098 | // Assert
1099 | expect(result).toBeTruthy();
1100 | });
1101 |
1102 | it('should return false when it feeds value with valid country code (FI) first and then numbers and string with length greater than 18', () => {
1103 | // Arrange
1104 | const value = 'FI12345678901234AB1';
1105 |
1106 | // Act
1107 | const result = hasValidLength(value);
1108 |
1109 | // Assert
1110 | expect(result).toBeFalsy();
1111 | });
1112 |
1113 | it('should return false when it feeds value with valid country code (FI) first and then numbers and string with length lower than 18', () => {
1114 | // Arrange
1115 | const value = 'FI12345678901234A';
1116 |
1117 | // Act
1118 | const result = hasValidLength(value);
1119 |
1120 | // Assert
1121 | expect(result).toBeFalsy();
1122 | });
1123 |
1124 | it('should return true when it feeds value with valid country code (FO) first and then numbers and string with length equals 18', () => {
1125 | // Arrange
1126 | const value = 'FO12345678901234AB';
1127 |
1128 | // Act
1129 | const result = hasValidLength(value);
1130 |
1131 | // Assert
1132 | expect(result).toBeTruthy();
1133 | });
1134 |
1135 | it('should return false when it feeds value with valid country code (FO) first and then numbers and string with length greater than 18', () => {
1136 | // Arrange
1137 | const value = 'FO12345678901234AB1';
1138 |
1139 | // Act
1140 | const result = hasValidLength(value);
1141 |
1142 | // Assert
1143 | expect(result).toBeFalsy();
1144 | });
1145 |
1146 | it('should return false when it feeds value with valid country code (FO) first and then numbers and string with length lower than 18', () => {
1147 | // Arrange
1148 | const value = 'FO12345678901234A';
1149 |
1150 | // Act
1151 | const result = hasValidLength(value);
1152 |
1153 | // Assert
1154 | expect(result).toBeFalsy();
1155 | });
1156 |
1157 | it('should return true when it feeds value with valid country code (FR) first and then numbers and string with length equals 27', () => {
1158 | // Arrange
1159 | const value = 'FR12345678901234567890123AB';
1160 |
1161 | // Act
1162 | const result = hasValidLength(value);
1163 |
1164 | // Assert
1165 | expect(result).toBeTruthy();
1166 | });
1167 |
1168 | it('should return false when it feeds value with valid country code (FR) first and then numbers and string with length greater than 27', () => {
1169 | // Arrange
1170 | const value = 'FR12345678901234567890123AB1';
1171 |
1172 | // Act
1173 | const result = hasValidLength(value);
1174 |
1175 | // Assert
1176 | expect(result).toBeFalsy();
1177 | });
1178 |
1179 | it('should return false when it feeds value with valid country code (FR) first and then numbers and string with length lower than 27', () => {
1180 | // Arrange
1181 | const value = 'FR12345678901234567890123A';
1182 |
1183 | // Act
1184 | const result = hasValidLength(value);
1185 |
1186 | // Assert
1187 | expect(result).toBeFalsy();
1188 | });
1189 |
1190 | it('should return true when it feeds value with valid country code (GB) first and then numbers and string with length equals 22', () => {
1191 | // Arrange
1192 | const value = 'GB123456789012345678AB';
1193 |
1194 | // Act
1195 | const result = hasValidLength(value);
1196 |
1197 | // Assert
1198 | expect(result).toBeTruthy();
1199 | });
1200 |
1201 | it('should return false when it feeds value with valid country code (GB) first and then numbers and string with length greater than 22', () => {
1202 | // Arrange
1203 | const value = 'GB123456789012345678AB1';
1204 |
1205 | // Act
1206 | const result = hasValidLength(value);
1207 |
1208 | // Assert
1209 | expect(result).toBeFalsy();
1210 | });
1211 |
1212 | it('should return false when it feeds value with valid country code (GB) first and then numbers and string with length lower than 22', () => {
1213 | // Arrange
1214 | const value = 'GB123456789012345678A';
1215 |
1216 | // Act
1217 | const result = hasValidLength(value);
1218 |
1219 | // Assert
1220 | expect(result).toBeFalsy();
1221 | });
1222 |
1223 | it('should return true when it feeds value with valid country code (GE) first and then numbers and string with length equals 22', () => {
1224 | // Arrange
1225 | const value = 'GE123456789012345678AB';
1226 |
1227 | // Act
1228 | const result = hasValidLength(value);
1229 |
1230 | // Assert
1231 | expect(result).toBeTruthy();
1232 | });
1233 |
1234 | it('should return false when it feeds value with valid country code (GE) first and then numbers and string with length greater than 22', () => {
1235 | // Arrange
1236 | const value = 'GE123456789012345678AB1';
1237 |
1238 | // Act
1239 | const result = hasValidLength(value);
1240 |
1241 | // Assert
1242 | expect(result).toBeFalsy();
1243 | });
1244 |
1245 | it('should return false when it feeds value with valid country code (GE) first and then numbers and string with length lower than 22', () => {
1246 | // Arrange
1247 | const value = 'GE123456789012345678A';
1248 |
1249 | // Act
1250 | const result = hasValidLength(value);
1251 |
1252 | // Assert
1253 | expect(result).toBeFalsy();
1254 | });
1255 |
1256 | it('should return true when it feeds value with valid country code (GI) first and then numbers and string with length equals 23', () => {
1257 | // Arrange
1258 | const value = 'GI1234567890123456789AB';
1259 |
1260 | // Act
1261 | const result = hasValidLength(value);
1262 |
1263 | // Assert
1264 | expect(result).toBeTruthy();
1265 | });
1266 |
1267 | it('should return false when it feeds value with valid country code (GI) first and then numbers and string with length greater than 23', () => {
1268 | // Arrange
1269 | const value = 'GI1234567890123456789AB1';
1270 |
1271 | // Act
1272 | const result = hasValidLength(value);
1273 |
1274 | // Assert
1275 | expect(result).toBeFalsy();
1276 | });
1277 |
1278 | it('should return false when it feeds value with valid country code (GI) first and then numbers and string with length lower than 23', () => {
1279 | // Arrange
1280 | const value = 'GI1234567890123456789A';
1281 |
1282 | // Act
1283 | const result = hasValidLength(value);
1284 |
1285 | // Assert
1286 | expect(result).toBeFalsy();
1287 | });
1288 |
1289 | it('should return true when it feeds value with valid country code (GL) first and then numbers and string with length equals 18', () => {
1290 | // Arrange
1291 | const value = 'GL12345678901234AB';
1292 |
1293 | // Act
1294 | const result = hasValidLength(value);
1295 |
1296 | // Assert
1297 | expect(result).toBeTruthy();
1298 | });
1299 |
1300 | it('should return false when it feeds value with valid country code (GL) first and then numbers and string with length greater than 18', () => {
1301 | // Arrange
1302 | const value = 'GL12345678901234AB1';
1303 |
1304 | // Act
1305 | const result = hasValidLength(value);
1306 |
1307 | // Assert
1308 | expect(result).toBeFalsy();
1309 | });
1310 |
1311 | it('should return false when it feeds value with valid country code (GL) first and then numbers and string with length lower than 18', () => {
1312 | // Arrange
1313 | const value = 'GL12345678901234A';
1314 |
1315 | // Act
1316 | const result = hasValidLength(value);
1317 |
1318 | // Assert
1319 | expect(result).toBeFalsy();
1320 | });
1321 |
1322 | it('should return true when it feeds value with valid country code (GR) first and then numbers and string with length equals 27', () => {
1323 | // Arrange
1324 | const value = 'GR12345678901234567890123AB';
1325 |
1326 | // Act
1327 | const result = hasValidLength(value);
1328 |
1329 | // Assert
1330 | expect(result).toBeTruthy();
1331 | });
1332 |
1333 | it('should return false when it feeds value with valid country code (GR) first and then numbers and string with length greater than 27', () => {
1334 | // Arrange
1335 | const value = 'GR12345678901234567890123AB1';
1336 |
1337 | // Act
1338 | const result = hasValidLength(value);
1339 |
1340 | // Assert
1341 | expect(result).toBeFalsy();
1342 | });
1343 |
1344 | it('should return false when it feeds value with valid country code (GR) first and then numbers and string with length lower than 27', () => {
1345 | // Arrange
1346 | const value = 'GR12345678901234567890123A';
1347 |
1348 | // Act
1349 | const result = hasValidLength(value);
1350 |
1351 | // Assert
1352 | expect(result).toBeFalsy();
1353 | });
1354 |
1355 | it('should return true when it feeds value with valid country code (GT) first and then numbers and string with length equals 28', () => {
1356 | // Arrange
1357 | const value = 'GT123456789012345678901234AB';
1358 |
1359 | // Act
1360 | const result = hasValidLength(value);
1361 |
1362 | // Assert
1363 | expect(result).toBeTruthy();
1364 | });
1365 |
1366 | it('should return false when it feeds value with valid country code (GT) first and then numbers and string with length greater than 28', () => {
1367 | // Arrange
1368 | const value = 'GT123456789012345678901234AB1';
1369 |
1370 | // Act
1371 | const result = hasValidLength(value);
1372 |
1373 | // Assert
1374 | expect(result).toBeFalsy();
1375 | });
1376 |
1377 | it('should return false when it feeds value with valid country code (GT) first and then numbers and string with length lower than 28', () => {
1378 | // Arrange
1379 | const value = 'GT123456789012345678901234A';
1380 |
1381 | // Act
1382 | const result = hasValidLength(value);
1383 |
1384 | // Assert
1385 | expect(result).toBeFalsy();
1386 | });
1387 |
1388 | it('should return true when it feeds value with valid country code (HR) first and then numbers and string with length equals 21', () => {
1389 | // Arrange
1390 | const value = 'HR12345678901234567AB';
1391 |
1392 | // Act
1393 | const result = hasValidLength(value);
1394 |
1395 | // Assert
1396 | expect(result).toBeTruthy();
1397 | });
1398 |
1399 | it('should return false when it feeds value with valid country code (HR) first and then numbers and string with length greater than 21', () => {
1400 | // Arrange
1401 | const value = 'HR12345678901234567AB1';
1402 |
1403 | // Act
1404 | const result = hasValidLength(value);
1405 |
1406 | // Assert
1407 | expect(result).toBeFalsy();
1408 | });
1409 |
1410 | it('should return false when it feeds value with valid country code (HR) first and then numbers and string with length lower than 21', () => {
1411 | // Arrange
1412 | const value = 'HR12345678901234567A';
1413 |
1414 | // Act
1415 | const result = hasValidLength(value);
1416 |
1417 | // Assert
1418 | expect(result).toBeFalsy();
1419 | });
1420 |
1421 | it('should return true when it feeds value with valid country code (HU) first and then numbers and string with length equals 28', () => {
1422 | // Arrange
1423 | const value = 'HU123456789012345678901234AB';
1424 |
1425 | // Act
1426 | const result = hasValidLength(value);
1427 |
1428 | // Assert
1429 | expect(result).toBeTruthy();
1430 | });
1431 |
1432 | it('should return false when it feeds value with valid country code (HU) first and then numbers and string with length greater than 28', () => {
1433 | // Arrange
1434 | const value = 'HU123456789012345678901234AB1';
1435 |
1436 | // Act
1437 | const result = hasValidLength(value);
1438 |
1439 | // Assert
1440 | expect(result).toBeFalsy();
1441 | });
1442 |
1443 | it('should return false when it feeds value with valid country code (HU) first and then numbers and string with length lower than 28', () => {
1444 | // Arrange
1445 | const value = 'HU123456789012345678901234A';
1446 |
1447 | // Act
1448 | const result = hasValidLength(value);
1449 |
1450 | // Assert
1451 | expect(result).toBeFalsy();
1452 | });
1453 |
1454 | it('should return true when it feeds value with valid country code (IE) first and then numbers and string with length equals 22', () => {
1455 | // Arrange
1456 | const value = 'IE123456789012345678AB';
1457 |
1458 | // Act
1459 | const result = hasValidLength(value);
1460 |
1461 | // Assert
1462 | expect(result).toBeTruthy();
1463 | });
1464 |
1465 | it('should return false when it feeds value with valid country code (IE) first and then numbers and string with length greater than 22', () => {
1466 | // Arrange
1467 | const value = 'IE123456789012345678AB1';
1468 |
1469 | // Act
1470 | const result = hasValidLength(value);
1471 |
1472 | // Assert
1473 | expect(result).toBeFalsy();
1474 | });
1475 |
1476 | it('should return false when it feeds value with valid country code (IE) first and then numbers and string with length lower than 22', () => {
1477 | // Arrange
1478 | const value = 'IE123456789012345678A';
1479 |
1480 | // Act
1481 | const result = hasValidLength(value);
1482 |
1483 | // Assert
1484 | expect(result).toBeFalsy();
1485 | });
1486 |
1487 | it('should return true when it feeds value with valid country code (IL) first and then numbers and string with length equals 23', () => {
1488 | // Arrange
1489 | const value = 'IL1234567890123456789AB';
1490 |
1491 | // Act
1492 | const result = hasValidLength(value);
1493 |
1494 | // Assert
1495 | expect(result).toBeTruthy();
1496 | });
1497 |
1498 | it('should return false when it feeds value with valid country code (IL) first and then numbers and string with length greater than 23', () => {
1499 | // Arrange
1500 | const value = 'IL1234567890123456789AB1';
1501 |
1502 | // Act
1503 | const result = hasValidLength(value);
1504 |
1505 | // Assert
1506 | expect(result).toBeFalsy();
1507 | });
1508 |
1509 | it('should return false when it feeds value with valid country code (IL) first and then numbers and string with length lower than 23', () => {
1510 | // Arrange
1511 | const value = 'IL1234567890123456789A';
1512 |
1513 | // Act
1514 | const result = hasValidLength(value);
1515 |
1516 | // Assert
1517 | expect(result).toBeFalsy();
1518 | });
1519 |
1520 | it('should return true when it feeds value with valid country code (IQ) first and then numbers and string with length equals 23', () => {
1521 | // Arrange
1522 | const value = 'IQ1234567890123456789AB';
1523 |
1524 | // Act
1525 | const result = hasValidLength(value);
1526 |
1527 | // Assert
1528 | expect(result).toBeTruthy();
1529 | });
1530 |
1531 | it('should return false when it feeds value with valid country code (IQ) first and then numbers and string with length greater than 23', () => {
1532 | // Arrange
1533 | const value = 'IQ1234567890123456789AB1';
1534 |
1535 | // Act
1536 | const result = hasValidLength(value);
1537 |
1538 | // Assert
1539 | expect(result).toBeFalsy();
1540 | });
1541 |
1542 | it('should return false when it feeds value with valid country code (IQ) first and then numbers and string with length lower than 23', () => {
1543 | // Arrange
1544 | const value = 'IQ1234567890123456789A';
1545 |
1546 | // Act
1547 | const result = hasValidLength(value);
1548 |
1549 | // Assert
1550 | expect(result).toBeFalsy();
1551 | });
1552 |
1553 | it('should return true when it feeds value with valid country code (IS) first and then numbers and string with length equals 26', () => {
1554 | // Arrange
1555 | const value = 'IS1234567890123456789012AB';
1556 |
1557 | // Act
1558 | const result = hasValidLength(value);
1559 |
1560 | // Assert
1561 | expect(result).toBeTruthy();
1562 | });
1563 |
1564 | it('should return false when it feeds value with valid country code (IS) first and then numbers and string with length greater than 26', () => {
1565 | // Arrange
1566 | const value = 'IS1234567890123456789012AB1';
1567 |
1568 | // Act
1569 | const result = hasValidLength(value);
1570 |
1571 | // Assert
1572 | expect(result).toBeFalsy();
1573 | });
1574 |
1575 | it('should return false when it feeds value with valid country code (IS) first and then numbers and string with length lower than 26', () => {
1576 | // Arrange
1577 | const value = 'IS1234567890123456789012A';
1578 |
1579 | // Act
1580 | const result = hasValidLength(value);
1581 |
1582 | // Assert
1583 | expect(result).toBeFalsy();
1584 | });
1585 |
1586 | it('should return true when it feeds value with valid country code (IR) first and then numbers and string with length equals 26', () => {
1587 | // Arrange
1588 | const value = 'IR1234567890123456789012AB';
1589 |
1590 | // Act
1591 | const result = hasValidLength(value);
1592 |
1593 | // Assert
1594 | expect(result).toBeTruthy();
1595 | });
1596 |
1597 | it('should return false when it feeds value with valid country code (IR) first and then numbers and string with length greater than 26', () => {
1598 | // Arrange
1599 | const value = 'IR1234567890123456789012AB1';
1600 |
1601 | // Act
1602 | const result = hasValidLength(value);
1603 |
1604 | // Assert
1605 | expect(result).toBeFalsy();
1606 | });
1607 |
1608 | it('should return false when it feeds value with valid country code (IR) first and then numbers and string with length lower than 26', () => {
1609 | // Arrange
1610 | const value = 'IR1234567890123456789012A';
1611 |
1612 | // Act
1613 | const result = hasValidLength(value);
1614 |
1615 | // Assert
1616 | expect(result).toBeFalsy();
1617 | });
1618 |
1619 | it('should return true when it feeds value with valid country code (IT) first and then numbers and string with length equals 27', () => {
1620 | // Arrange
1621 | const value = 'IT12345678901234567890123AB';
1622 |
1623 | // Act
1624 | const result = hasValidLength(value);
1625 |
1626 | // Assert
1627 | expect(result).toBeTruthy();
1628 | });
1629 |
1630 | it('should return false when it feeds value with valid country code (IT) first and then numbers and string with length greater than 27', () => {
1631 | // Arrange
1632 | const value = 'IT12345678901234567890123AB1';
1633 |
1634 | // Act
1635 | const result = hasValidLength(value);
1636 |
1637 | // Assert
1638 | expect(result).toBeFalsy();
1639 | });
1640 |
1641 | it('should return false when it feeds value with valid country code (IT) first and then numbers and string with length lower than 27', () => {
1642 | // Arrange
1643 | const value = 'IT12345678901234567890123A';
1644 |
1645 | // Act
1646 | const result = hasValidLength(value);
1647 |
1648 | // Assert
1649 | expect(result).toBeFalsy();
1650 | });
1651 |
1652 | it('should return true when it feeds value with valid country code (JO) first and then numbers and string with length equals 30', () => {
1653 | // Arrange
1654 | const value = 'JO12345678901234567890123456AB';
1655 |
1656 | // Act
1657 | const result = hasValidLength(value);
1658 |
1659 | // Assert
1660 | expect(result).toBeTruthy();
1661 | });
1662 |
1663 | it('should return false when it feeds value with valid country code (JO) first and then numbers and string with length greater than 30', () => {
1664 | // Arrange
1665 | const value = 'JO12345678901234567890123456AB1';
1666 |
1667 | // Act
1668 | const result = hasValidLength(value);
1669 |
1670 | // Assert
1671 | expect(result).toBeFalsy();
1672 | });
1673 |
1674 | it('should return false when it feeds value with valid country code (JO) first and then numbers and string with length lower than 30', () => {
1675 | // Arrange
1676 | const value = 'JO12345678901234567890123456A';
1677 |
1678 | // Act
1679 | const result = hasValidLength(value);
1680 |
1681 | // Assert
1682 | expect(result).toBeFalsy();
1683 | });
1684 |
1685 | it('should return true when it feeds value with valid country code (KW) first and then numbers and string with length equals 30', () => {
1686 | // Arrange
1687 | const value = 'KW12345678901234567890123456AB';
1688 |
1689 | // Act
1690 | const result = hasValidLength(value);
1691 |
1692 | // Assert
1693 | expect(result).toBeTruthy();
1694 | });
1695 |
1696 | it('should return false when it feeds value with valid country code (KW) first and then numbers and string with length greater than 30', () => {
1697 | // Arrange
1698 | const value = 'KW12345678901234567890123456AB1';
1699 |
1700 | // Act
1701 | const result = hasValidLength(value);
1702 |
1703 | // Assert
1704 | expect(result).toBeFalsy();
1705 | });
1706 |
1707 | it('should return false when it feeds value with valid country code (KW) first and then numbers and string with length lower than 30', () => {
1708 | // Arrange
1709 | const value = 'KW12345678901234567890123456A';
1710 |
1711 | // Act
1712 | const result = hasValidLength(value);
1713 |
1714 | // Assert
1715 | expect(result).toBeFalsy();
1716 | });
1717 |
1718 | it('should return true when it feeds value with valid country code (KZ) first and then numbers and string with length equals 20', () => {
1719 | // Arrange
1720 | const value = 'KZ1234567890123456AB';
1721 |
1722 | // Act
1723 | const result = hasValidLength(value);
1724 |
1725 | // Assert
1726 | expect(result).toBeTruthy();
1727 | });
1728 |
1729 | it('should return false when it feeds value with valid country code (KZ) first and then numbers and string with length greater than 20', () => {
1730 | // Arrange
1731 | const value = 'KZ1234567890123456AB1';
1732 |
1733 | // Act
1734 | const result = hasValidLength(value);
1735 |
1736 | // Assert
1737 | expect(result).toBeFalsy();
1738 | });
1739 |
1740 | it('should return false when it feeds value with valid country code (KZ) first and then numbers and string with length lower than 20', () => {
1741 | // Arrange
1742 | const value = 'KZ1234567890123456A';
1743 |
1744 | // Act
1745 | const result = hasValidLength(value);
1746 |
1747 | // Assert
1748 | expect(result).toBeFalsy();
1749 | });
1750 |
1751 | it('should return true when it feeds value with valid country code (LB) first and then numbers and string with length equals 28', () => {
1752 | // Arrange
1753 | const value = 'LB123456789012345678901234AB';
1754 |
1755 | // Act
1756 | const result = hasValidLength(value);
1757 |
1758 | // Assert
1759 | expect(result).toBeTruthy();
1760 | });
1761 |
1762 | it('should return false when it feeds value with valid country code (LB) first and then numbers and string with length greater than 28', () => {
1763 | // Arrange
1764 | const value = 'LB123456789012345678901234AB1';
1765 |
1766 | // Act
1767 | const result = hasValidLength(value);
1768 |
1769 | // Assert
1770 | expect(result).toBeFalsy();
1771 | });
1772 |
1773 | it('should return false when it feeds value with valid country code (LB) first and then numbers and string with length lower than 28', () => {
1774 | // Arrange
1775 | const value = 'LB123456789012345678901234A';
1776 |
1777 | // Act
1778 | const result = hasValidLength(value);
1779 |
1780 | // Assert
1781 | expect(result).toBeFalsy();
1782 | });
1783 |
1784 | it('should return true when it feeds value with valid country code (LC) first and then numbers and string with length equals 32', () => {
1785 | // Arrange
1786 | const value = 'LC1234567890123456789012345678AB';
1787 |
1788 | // Act
1789 | const result = hasValidLength(value);
1790 |
1791 | // Assert
1792 | expect(result).toBeTruthy();
1793 | });
1794 |
1795 | it('should return false when it feeds value with valid country code (LC) first and then numbers and string with length greater than 32', () => {
1796 | // Arrange
1797 | const value = 'LC1234567890123456789012345678AB1';
1798 |
1799 | // Act
1800 | const result = hasValidLength(value);
1801 |
1802 | // Assert
1803 | expect(result).toBeFalsy();
1804 | });
1805 |
1806 | it('should return false when it feeds value with valid country code (LC) first and then numbers and string with length lower than 32', () => {
1807 | // Arrange
1808 | const value = 'LC1234567890123456789012345678A';
1809 |
1810 | // Act
1811 | const result = hasValidLength(value);
1812 |
1813 | // Assert
1814 | expect(result).toBeFalsy();
1815 | });
1816 |
1817 | it('should return true when it feeds value with valid country code (LI) first and then numbers and string with length equals 21', () => {
1818 | // Arrange
1819 | const value = 'LI12345678901234567AB';
1820 |
1821 | // Act
1822 | const result = hasValidLength(value);
1823 |
1824 | // Assert
1825 | expect(result).toBeTruthy();
1826 | });
1827 |
1828 | it('should return false when it feeds value with valid country code (LI) first and then numbers and string with length greater than 21', () => {
1829 | // Arrange
1830 | const value = 'LI12345678901234567AB1';
1831 |
1832 | // Act
1833 | const result = hasValidLength(value);
1834 |
1835 | // Assert
1836 | expect(result).toBeFalsy();
1837 | });
1838 |
1839 | it('should return false when it feeds value with valid country code (LI) first and then numbers and string with length lower than 21', () => {
1840 | // Arrange
1841 | const value = 'LI12345678901234567A';
1842 |
1843 | // Act
1844 | const result = hasValidLength(value);
1845 |
1846 | // Assert
1847 | expect(result).toBeFalsy();
1848 | });
1849 |
1850 | it('should return true when it feeds value with valid country code (LT) first and then numbers and string with length equals 20', () => {
1851 | // Arrange
1852 | const value = 'LT1234567890123456AB';
1853 |
1854 | // Act
1855 | const result = hasValidLength(value);
1856 |
1857 | // Assert
1858 | expect(result).toBeTruthy();
1859 | });
1860 |
1861 | it('should return false when it feeds value with valid country code (LT) first and then numbers and string with length greater than 20', () => {
1862 | // Arrange
1863 | const value = 'LT1234567890123456AB1';
1864 |
1865 | // Act
1866 | const result = hasValidLength(value);
1867 |
1868 | // Assert
1869 | expect(result).toBeFalsy();
1870 | });
1871 |
1872 | it('should return false when it feeds value with valid country code (LT) first and then numbers and string with length lower than 20', () => {
1873 | // Arrange
1874 | const value = 'LT1234567890123456A';
1875 |
1876 | // Act
1877 | const result = hasValidLength(value);
1878 |
1879 | // Assert
1880 | expect(result).toBeFalsy();
1881 | });
1882 |
1883 | it('should return true when it feeds value with valid country code (LU) first and then numbers and string with length equals 20', () => {
1884 | // Arrange
1885 | const value = 'LU1234567890123456AB';
1886 |
1887 | // Act
1888 | const result = hasValidLength(value);
1889 |
1890 | // Assert
1891 | expect(result).toBeTruthy();
1892 | });
1893 |
1894 | it('should return false when it feeds value with valid country code (LU) first and then numbers and string with length greater than 20', () => {
1895 | // Arrange
1896 | const value = 'LU1234567890123456AB1';
1897 |
1898 | // Act
1899 | const result = hasValidLength(value);
1900 |
1901 | // Assert
1902 | expect(result).toBeFalsy();
1903 | });
1904 |
1905 | it('should return false when it feeds value with valid country code (LU) first and then numbers and string with length lower than 20', () => {
1906 | // Arrange
1907 | const value = 'LU1234567890123456A';
1908 |
1909 | // Act
1910 | const result = hasValidLength(value);
1911 |
1912 | // Assert
1913 | expect(result).toBeFalsy();
1914 | });
1915 |
1916 | it('should return true when it feeds value with valid country code (LV) first and then numbers and string with length equals 21', () => {
1917 | // Arrange
1918 | const value = 'LV12345678901234567AB';
1919 |
1920 | // Act
1921 | const result = hasValidLength(value);
1922 |
1923 | // Assert
1924 | expect(result).toBeTruthy();
1925 | });
1926 |
1927 | it('should return false when it feeds value with valid country code (LV) first and then numbers and string with length greater than 21', () => {
1928 | // Arrange
1929 | const value = 'LV12345678901234567AB1';
1930 |
1931 | // Act
1932 | const result = hasValidLength(value);
1933 |
1934 | // Assert
1935 | expect(result).toBeFalsy();
1936 | });
1937 |
1938 | it('should return false when it feeds value with valid country code (LV) first and then numbers and string with length lower than 21', () => {
1939 | // Arrange
1940 | const value = 'LV12345678901234567A';
1941 |
1942 | // Act
1943 | const result = hasValidLength(value);
1944 |
1945 | // Assert
1946 | expect(result).toBeFalsy();
1947 | });
1948 |
1949 | it('should return true when it feeds value with valid country code (MC) first and then numbers and string with length equals 27', () => {
1950 | // Arrange
1951 | const value = 'MC12345678901234567890123AB';
1952 |
1953 | // Act
1954 | const result = hasValidLength(value);
1955 |
1956 | // Assert
1957 | expect(result).toBeTruthy();
1958 | });
1959 |
1960 | it('should return false when it feeds value with valid country code (MC) first and then numbers and string with length greater than 27', () => {
1961 | // Arrange
1962 | const value = 'MC12345678901234567890123AB1';
1963 |
1964 | // Act
1965 | const result = hasValidLength(value);
1966 |
1967 | // Assert
1968 | expect(result).toBeFalsy();
1969 | });
1970 |
1971 | it('should return false when it feeds value with valid country code (MC) first and then numbers and string with length lower than 27', () => {
1972 | // Arrange
1973 | const value = 'MC12345678901234567890123A';
1974 |
1975 | // Act
1976 | const result = hasValidLength(value);
1977 |
1978 | // Assert
1979 | expect(result).toBeFalsy();
1980 | });
1981 |
1982 | it('should return true when it feeds value with valid country code (MD) first and then numbers and string with length equals 24', () => {
1983 | // Arrange
1984 | const value = 'MD12345678901234567890AB';
1985 |
1986 | // Act
1987 | const result = hasValidLength(value);
1988 |
1989 | // Assert
1990 | expect(result).toBeTruthy();
1991 | });
1992 |
1993 | it('should return false when it feeds value with valid country code (MD) first and then numbers and string with length greater than 24', () => {
1994 | // Arrange
1995 | const value = 'MD12345678901234567890AB1';
1996 |
1997 | // Act
1998 | const result = hasValidLength(value);
1999 |
2000 | // Assert
2001 | expect(result).toBeFalsy();
2002 | });
2003 |
2004 | it('should return false when it feeds value with valid country code (MD) first and then numbers and string with length lower than 24', () => {
2005 | // Arrange
2006 | const value = 'MD12345678901234567890A';
2007 |
2008 | // Act
2009 | const result = hasValidLength(value);
2010 |
2011 | // Assert
2012 | expect(result).toBeFalsy();
2013 | });
2014 |
2015 | it('should return true when it feeds value with valid country code (ME) first and then numbers and string with length equals 22', () => {
2016 | // Arrange
2017 | const value = 'ME123456789012345678AB';
2018 |
2019 | // Act
2020 | const result = hasValidLength(value);
2021 |
2022 | // Assert
2023 | expect(result).toBeTruthy();
2024 | });
2025 |
2026 | it('should return false when it feeds value with valid country code (ME) first and then numbers and string with length greater than 22', () => {
2027 | // Arrange
2028 | const value = 'ME123456789012345678AB1';
2029 |
2030 | // Act
2031 | const result = hasValidLength(value);
2032 |
2033 | // Assert
2034 | expect(result).toBeFalsy();
2035 | });
2036 |
2037 | it('should return false when it feeds value with valid country code (ME) first and then numbers and string with length lower than 22', () => {
2038 | // Arrange
2039 | const value = 'ME123456789012345678A';
2040 |
2041 | // Act
2042 | const result = hasValidLength(value);
2043 |
2044 | // Assert
2045 | expect(result).toBeFalsy();
2046 | });
2047 |
2048 | it('should return true when it feeds value with valid country code (MG) first and then numbers and string with length equals 27', () => {
2049 | // Arrange
2050 | const value = 'MG12345678901234567890123AB';
2051 |
2052 | // Act
2053 | const result = hasValidLength(value);
2054 |
2055 | // Assert
2056 | expect(result).toBeTruthy();
2057 | });
2058 |
2059 | it('should return false when it feeds value with valid country code (MG) first and then numbers and string with length greater than 27', () => {
2060 | // Arrange
2061 | const value = 'MG12345678901234567890123AB1';
2062 |
2063 | // Act
2064 | const result = hasValidLength(value);
2065 |
2066 | // Assert
2067 | expect(result).toBeFalsy();
2068 | });
2069 |
2070 | it('should return false when it feeds value with valid country code (MG) first and then numbers and string with length lower than 27', () => {
2071 | // Arrange
2072 | const value = 'MG12345678901234567890123A';
2073 |
2074 | // Act
2075 | const result = hasValidLength(value);
2076 |
2077 | // Assert
2078 | expect(result).toBeFalsy();
2079 | });
2080 |
2081 | it('should return true when it feeds value with valid country code (MK) first and then numbers and string with length equals 19', () => {
2082 | // Arrange
2083 | const value = 'MK123456789012345AB';
2084 |
2085 | // Act
2086 | const result = hasValidLength(value);
2087 |
2088 | // Assert
2089 | expect(result).toBeTruthy();
2090 | });
2091 |
2092 | it('should return false when it feeds value with valid country code (MK) first and then numbers and string with length greater than 19', () => {
2093 | // Arrange
2094 | const value = 'MK123456789012345AB1';
2095 |
2096 | // Act
2097 | const result = hasValidLength(value);
2098 |
2099 | // Assert
2100 | expect(result).toBeFalsy();
2101 | });
2102 |
2103 | it('should return false when it feeds value with valid country code (MK) first and then numbers and string with length lower than 19', () => {
2104 | // Arrange
2105 | const value = 'MK123456789012345A';
2106 |
2107 | // Act
2108 | const result = hasValidLength(value);
2109 |
2110 | // Assert
2111 | expect(result).toBeFalsy();
2112 | });
2113 |
2114 | it('should return true when it feeds value with valid country code (ML) first and then numbers and string with length equals 28', () => {
2115 | // Arrange
2116 | const value = 'ML123456789012345678901234AB';
2117 |
2118 | // Act
2119 | const result = hasValidLength(value);
2120 |
2121 | // Assert
2122 | expect(result).toBeTruthy();
2123 | });
2124 |
2125 | it('should return false when it feeds value with valid country code (ML) first and then numbers and string with length greater than 28', () => {
2126 | // Arrange
2127 | const value = 'ML123456789012345678901234AB1';
2128 |
2129 | // Act
2130 | const result = hasValidLength(value);
2131 |
2132 | // Assert
2133 | expect(result).toBeFalsy();
2134 | });
2135 |
2136 | it('should return false when it feeds value with valid country code (ML) first and then numbers and string with length lower than 28', () => {
2137 | // Arrange
2138 | const value = 'ML123456789012345678901234A';
2139 |
2140 | // Act
2141 | const result = hasValidLength(value);
2142 |
2143 | // Assert
2144 | expect(result).toBeFalsy();
2145 | });
2146 |
2147 | it('should return true when it feeds value with valid country code (MR) first and then numbers and string with length equals 27', () => {
2148 | // Arrange
2149 | const value = 'MR12345678901234567890123AB';
2150 |
2151 | // Act
2152 | const result = hasValidLength(value);
2153 |
2154 | // Assert
2155 | expect(result).toBeTruthy();
2156 | });
2157 |
2158 | it('should return false when it feeds value with valid country code (MR) first and then numbers and string with length greater than 27', () => {
2159 | // Arrange
2160 | const value = 'MR12345678901234567890123AB1';
2161 |
2162 | // Act
2163 | const result = hasValidLength(value);
2164 |
2165 | // Assert
2166 | expect(result).toBeFalsy();
2167 | });
2168 |
2169 | it('should return false when it feeds value with valid country code (MR) first and then numbers and string with length lower than 27', () => {
2170 | // Arrange
2171 | const value = 'MR12345678901234567890123A';
2172 |
2173 | // Act
2174 | const result = hasValidLength(value);
2175 |
2176 | // Assert
2177 | expect(result).toBeFalsy();
2178 | });
2179 |
2180 | it('should return true when it feeds value with valid country code (MT) first and then numbers and string with length equals 31', () => {
2181 | // Arrange
2182 | const value = 'MT123456789012345678901234567AB';
2183 |
2184 | // Act
2185 | const result = hasValidLength(value);
2186 |
2187 | // Assert
2188 | expect(result).toBeTruthy();
2189 | });
2190 |
2191 | it('should return false when it feeds value with valid country code (MT) first and then numbers and string with length greater than 31', () => {
2192 | // Arrange
2193 | const value = 'MT123456789012345678901234567AB1';
2194 |
2195 | // Act
2196 | const result = hasValidLength(value);
2197 |
2198 | // Assert
2199 | expect(result).toBeFalsy();
2200 | });
2201 |
2202 | it('should return false when it feeds value with valid country code (MT) first and then numbers and string with length lower than 31', () => {
2203 | // Arrange
2204 | const value = 'MT123456789012345678901234567A';
2205 |
2206 | // Act
2207 | const result = hasValidLength(value);
2208 |
2209 | // Assert
2210 | expect(result).toBeFalsy();
2211 | });
2212 |
2213 | it('should return true when it feeds value with valid country code (MU) first and then numbers and string with length equals 30', () => {
2214 | // Arrange
2215 | const value = 'MU12345678901234567890123456AB';
2216 |
2217 | // Act
2218 | const result = hasValidLength(value);
2219 |
2220 | // Assert
2221 | expect(result).toBeTruthy();
2222 | });
2223 |
2224 | it('should return false when it feeds value with valid country code (MU) first and then numbers and string with length greater than 30', () => {
2225 | // Arrange
2226 | const value = 'MU12345678901234567890123456AB1';
2227 |
2228 | // Act
2229 | const result = hasValidLength(value);
2230 |
2231 | // Assert
2232 | expect(result).toBeFalsy();
2233 | });
2234 |
2235 | it('should return false when it feeds value with valid country code (MU) first and then numbers and string with length lower than 30', () => {
2236 | // Arrange
2237 | const value = 'MU12345678901234567890123456A';
2238 |
2239 | // Act
2240 | const result = hasValidLength(value);
2241 |
2242 | // Assert
2243 | expect(result).toBeFalsy();
2244 | });
2245 |
2246 | it('should return true when it feeds value with valid country code (MZ) first and then numbers and string with length equals 25', () => {
2247 | // Arrange
2248 | const value = 'MZ123456789012345678901AB';
2249 |
2250 | // Act
2251 | const result = hasValidLength(value);
2252 |
2253 | // Assert
2254 | expect(result).toBeTruthy();
2255 | });
2256 |
2257 | it('should return false when it feeds value with valid country code (MZ) first and then numbers and string with length greater than 25', () => {
2258 | // Arrange
2259 | const value = 'MZ123456789012345678901AB1';
2260 |
2261 | // Act
2262 | const result = hasValidLength(value);
2263 |
2264 | // Assert
2265 | expect(result).toBeFalsy();
2266 | });
2267 |
2268 | it('should return false when it feeds value with valid country code (MZ) first and then numbers and string with length lower than 25', () => {
2269 | // Arrange
2270 | const value = 'MZ123456789012345678901A';
2271 |
2272 | // Act
2273 | const result = hasValidLength(value);
2274 |
2275 | // Assert
2276 | expect(result).toBeFalsy();
2277 | });
2278 |
2279 | it('should return true when it feeds value with valid country code (NL) first and then numbers and string with length equals 18', () => {
2280 | // Arrange
2281 | const value = 'NL12345678901234AB';
2282 |
2283 | // Act
2284 | const result = hasValidLength(value);
2285 |
2286 | // Assert
2287 | expect(result).toBeTruthy();
2288 | });
2289 |
2290 | it('should return false when it feeds value with valid country code (NL) first and then numbers and string with length greater than 18', () => {
2291 | // Arrange
2292 | const value = 'NL12345678901234AB1';
2293 |
2294 | // Act
2295 | const result = hasValidLength(value);
2296 |
2297 | // Assert
2298 | expect(result).toBeFalsy();
2299 | });
2300 |
2301 | it('should return false when it feeds value with valid country code (NL) first and then numbers and string with length lower than 18', () => {
2302 | // Arrange
2303 | const value = 'NL12345678901234A';
2304 |
2305 | // Act
2306 | const result = hasValidLength(value);
2307 |
2308 | // Assert
2309 | expect(result).toBeFalsy();
2310 | });
2311 |
2312 | it('should return true when it feeds value with valid country code (NO) first and then numbers and string with length equals 15', () => {
2313 | // Arrange
2314 | const value = 'NO12345678901AB';
2315 |
2316 | // Act
2317 | const result = hasValidLength(value);
2318 |
2319 | // Assert
2320 | expect(result).toBeTruthy();
2321 | });
2322 |
2323 | it('should return false when it feeds value with valid country code (NO) first and then numbers and string with length greater than 15', () => {
2324 | // Arrange
2325 | const value = 'NO12345678901AB1';
2326 |
2327 | // Act
2328 | const result = hasValidLength(value);
2329 |
2330 | // Assert
2331 | expect(result).toBeFalsy();
2332 | });
2333 |
2334 | it('should return false when it feeds value with valid country code (NO) first and then numbers and string with length lower than 15', () => {
2335 | // Arrange
2336 | const value = 'NO12345678901A';
2337 |
2338 | // Act
2339 | const result = hasValidLength(value);
2340 |
2341 | // Assert
2342 | expect(result).toBeFalsy();
2343 | });
2344 |
2345 | it('should return true when it feeds value with valid country code (PK) first and then numbers and string with length equals 24', () => {
2346 | // Arrange
2347 | const value = 'PK12345678901234567890AB';
2348 |
2349 | // Act
2350 | const result = hasValidLength(value);
2351 |
2352 | // Assert
2353 | expect(result).toBeTruthy();
2354 | });
2355 |
2356 | it('should return false when it feeds value with valid country code (PK) first and then numbers and string with length greater than 24', () => {
2357 | // Arrange
2358 | const value = 'PK12345678901234567890AB1';
2359 |
2360 | // Act
2361 | const result = hasValidLength(value);
2362 |
2363 | // Assert
2364 | expect(result).toBeFalsy();
2365 | });
2366 |
2367 | it('should return false when it feeds value with valid country code (PK) first and then numbers and string with length lower than 24', () => {
2368 | // Arrange
2369 | const value = 'PK12345678901234567890A';
2370 |
2371 | // Act
2372 | const result = hasValidLength(value);
2373 |
2374 | // Assert
2375 | expect(result).toBeFalsy();
2376 | });
2377 |
2378 | it('should return true when it feeds value with valid country code (PL) first and then numbers and string with length equals 28', () => {
2379 | // Arrange
2380 | const value = 'PL123456789012345678901234AB';
2381 |
2382 | // Act
2383 | const result = hasValidLength(value);
2384 |
2385 | // Assert
2386 | expect(result).toBeTruthy();
2387 | });
2388 |
2389 | it('should return false when it feeds value with valid country code (PL) first and then numbers and string with length greater than 28', () => {
2390 | // Arrange
2391 | const value = 'PL123456789012345678901234AB1';
2392 |
2393 | // Act
2394 | const result = hasValidLength(value);
2395 |
2396 | // Assert
2397 | expect(result).toBeFalsy();
2398 | });
2399 |
2400 | it('should return false when it feeds value with valid country code (PL) first and then numbers and string with length lower than 28', () => {
2401 | // Arrange
2402 | const value = 'PL123456789012345678901234A';
2403 |
2404 | // Act
2405 | const result = hasValidLength(value);
2406 |
2407 | // Assert
2408 | expect(result).toBeFalsy();
2409 | });
2410 |
2411 | it('should return true when it feeds value with valid country code (PS) first and then numbers and string with length equals 29', () => {
2412 | // Arrange
2413 | const value = 'PS1234567890123456789012345AB';
2414 |
2415 | // Act
2416 | const result = hasValidLength(value);
2417 |
2418 | // Assert
2419 | expect(result).toBeTruthy();
2420 | });
2421 |
2422 | it('should return false when it feeds value with valid country code (PS) first and then numbers and string with length greater than 29', () => {
2423 | // Arrange
2424 | const value = 'PS1234567890123456789012345AB1';
2425 |
2426 | // Act
2427 | const result = hasValidLength(value);
2428 |
2429 | // Assert
2430 | expect(result).toBeFalsy();
2431 | });
2432 |
2433 | it('should return false when it feeds value with valid country code (PS) first and then numbers and string with length lower than 29', () => {
2434 | // Arrange
2435 | const value = 'PS1234567890123456789012345A';
2436 |
2437 | // Act
2438 | const result = hasValidLength(value);
2439 |
2440 | // Assert
2441 | expect(result).toBeFalsy();
2442 | });
2443 |
2444 | it('should return true when it feeds value with valid country code (PT) first and then numbers and string with length equals 25', () => {
2445 | // Arrange
2446 | const value = 'PT123456789012345678901AB';
2447 |
2448 | // Act
2449 | const result = hasValidLength(value);
2450 |
2451 | // Assert
2452 | expect(result).toBeTruthy();
2453 | });
2454 |
2455 | it('should return false when it feeds value with valid country code (PT) first and then numbers and string with length greater than 25', () => {
2456 | // Arrange
2457 | const value = 'PT123456789012345678901AB1';
2458 |
2459 | // Act
2460 | const result = hasValidLength(value);
2461 |
2462 | // Assert
2463 | expect(result).toBeFalsy();
2464 | });
2465 |
2466 | it('should return false when it feeds value with valid country code (PT) first and then numbers and string with length lower than 25', () => {
2467 | // Arrange
2468 | const value = 'PT123456789012345678901A';
2469 |
2470 | // Act
2471 | const result = hasValidLength(value);
2472 |
2473 | // Assert
2474 | expect(result).toBeFalsy();
2475 | });
2476 |
2477 | it('should return true when it feeds value with valid country code (QA) first and then numbers and string with length equals 29', () => {
2478 | // Arrange
2479 | const value = 'QA1234567890123456789012345AB';
2480 |
2481 | // Act
2482 | const result = hasValidLength(value);
2483 |
2484 | // Assert
2485 | expect(result).toBeTruthy();
2486 | });
2487 |
2488 | it('should return false when it feeds value with valid country code (QA) first and then numbers and string with length greater than 29', () => {
2489 | // Arrange
2490 | const value = 'QA1234567890123456789012345AB1';
2491 |
2492 | // Act
2493 | const result = hasValidLength(value);
2494 |
2495 | // Assert
2496 | expect(result).toBeFalsy();
2497 | });
2498 |
2499 | it('should return false when it feeds value with valid country code (QA) first and then numbers and string with length lower than 29', () => {
2500 | // Arrange
2501 | const value = 'QA1234567890123456789012345A';
2502 |
2503 | // Act
2504 | const result = hasValidLength(value);
2505 |
2506 | // Assert
2507 | expect(result).toBeFalsy();
2508 | });
2509 |
2510 | it('should return true when it feeds value with valid country code (RO) first and then numbers and string with length equals 24', () => {
2511 | // Arrange
2512 | const value = 'RO12345678901234567890AB';
2513 |
2514 | // Act
2515 | const result = hasValidLength(value);
2516 |
2517 | // Assert
2518 | expect(result).toBeTruthy();
2519 | });
2520 |
2521 | it('should return false when it feeds value with valid country code (RO) first and then numbers and string with length greater than 24', () => {
2522 | // Arrange
2523 | const value = 'RO12345678901234567890AB1';
2524 |
2525 | // Act
2526 | const result = hasValidLength(value);
2527 |
2528 | // Assert
2529 | expect(result).toBeFalsy();
2530 | });
2531 |
2532 | it('should return false when it feeds value with valid country code (RO) first and then numbers and string with length lower than 24', () => {
2533 | // Arrange
2534 | const value = 'RO12345678901234567890A';
2535 |
2536 | // Act
2537 | const result = hasValidLength(value);
2538 |
2539 | // Assert
2540 | expect(result).toBeFalsy();
2541 | });
2542 |
2543 | it('should return true when it feeds value with valid country code (RS) first and then numbers and string with length equals 22', () => {
2544 | // Arrange
2545 | const value = 'RS123456789012345678AB';
2546 |
2547 | // Act
2548 | const result = hasValidLength(value);
2549 |
2550 | // Assert
2551 | expect(result).toBeTruthy();
2552 | });
2553 |
2554 | it('should return false when it feeds value with valid country code (RS) first and then numbers and string with length greater than 22', () => {
2555 | // Arrange
2556 | const value = 'RS123456789012345678AB1';
2557 |
2558 | // Act
2559 | const result = hasValidLength(value);
2560 |
2561 | // Assert
2562 | expect(result).toBeFalsy();
2563 | });
2564 |
2565 | it('should return false when it feeds value with valid country code (RS) first and then numbers and string with length lower than 22', () => {
2566 | // Arrange
2567 | const value = 'RS123456789012345678A';
2568 |
2569 | // Act
2570 | const result = hasValidLength(value);
2571 |
2572 | // Assert
2573 | expect(result).toBeFalsy();
2574 | });
2575 |
2576 | it('should return true when it feeds value with valid country code (SA) first and then numbers and string with length equals 24', () => {
2577 | // Arrange
2578 | const value = 'SA12345678901234567890AB';
2579 |
2580 | // Act
2581 | const result = hasValidLength(value);
2582 |
2583 | // Assert
2584 | expect(result).toBeTruthy();
2585 | });
2586 |
2587 | it('should return false when it feeds value with valid country code (SA) first and then numbers and string with length greater than 24', () => {
2588 | // Arrange
2589 | const value = 'SA12345678901234567890AB1';
2590 |
2591 | // Act
2592 | const result = hasValidLength(value);
2593 |
2594 | // Assert
2595 | expect(result).toBeFalsy();
2596 | });
2597 |
2598 | it('should return false when it feeds value with valid country code (SA) first and then numbers and string with length lower than 24', () => {
2599 | // Arrange
2600 | const value = 'SA12345678901234567890A';
2601 |
2602 | // Act
2603 | const result = hasValidLength(value);
2604 |
2605 | // Assert
2606 | expect(result).toBeFalsy();
2607 | });
2608 |
2609 | it('should return true when it feeds value with valid country code (SC) first and then numbers and string with length equals 31', () => {
2610 | // Arrange
2611 | const value = 'SC123456789012345678901234567AB';
2612 |
2613 | // Act
2614 | const result = hasValidLength(value);
2615 |
2616 | // Assert
2617 | expect(result).toBeTruthy();
2618 | });
2619 |
2620 | it('should return false when it feeds value with valid country code (SC) first and then numbers and string with length greater than 31', () => {
2621 | // Arrange
2622 | const value = 'SC123456789012345678901234567AB1';
2623 |
2624 | // Act
2625 | const result = hasValidLength(value);
2626 |
2627 | // Assert
2628 | expect(result).toBeFalsy();
2629 | });
2630 |
2631 | it('should return false when it feeds value with valid country code (SC) first and then numbers and string with length lower than 31', () => {
2632 | // Arrange
2633 | const value = 'SC123456789012345678901234567A';
2634 |
2635 | // Act
2636 | const result = hasValidLength(value);
2637 |
2638 | // Assert
2639 | expect(result).toBeFalsy();
2640 | });
2641 |
2642 | it('should return true when it feeds value with valid country code (SE) first and then numbers and string with length equals 24', () => {
2643 | // Arrange
2644 | const value = 'SE12345678901234567890AB';
2645 |
2646 | // Act
2647 | const result = hasValidLength(value);
2648 |
2649 | // Assert
2650 | expect(result).toBeTruthy();
2651 | });
2652 |
2653 | it('should return false when it feeds value with valid country code (SE) first and then numbers and string with length greater than 24', () => {
2654 | // Arrange
2655 | const value = 'SE12345678901234567890AB1';
2656 |
2657 | // Act
2658 | const result = hasValidLength(value);
2659 |
2660 | // Assert
2661 | expect(result).toBeFalsy();
2662 | });
2663 |
2664 | it('should return false when it feeds value with valid country code (SE) first and then numbers and string with length lower than 24', () => {
2665 | // Arrange
2666 | const value = 'SE12345678901234567890A';
2667 |
2668 | // Act
2669 | const result = hasValidLength(value);
2670 |
2671 | // Assert
2672 | expect(result).toBeFalsy();
2673 | });
2674 |
2675 | it('should return true when it feeds value with valid country code (SI) first and then numbers and string with length equals 19', () => {
2676 | // Arrange
2677 | const value = 'SI123456789012345AB';
2678 |
2679 | // Act
2680 | const result = hasValidLength(value);
2681 |
2682 | // Assert
2683 | expect(result).toBeTruthy();
2684 | });
2685 |
2686 | it('should return false when it feeds value with valid country code (SI) first and then numbers and string with length greater than 19', () => {
2687 | // Arrange
2688 | const value = 'SI123456789012345AB1';
2689 |
2690 | // Act
2691 | const result = hasValidLength(value);
2692 |
2693 | // Assert
2694 | expect(result).toBeFalsy();
2695 | });
2696 |
2697 | it('should return false when it feeds value with valid country code (SI) first and then numbers and string with length lower than 19', () => {
2698 | // Arrange
2699 | const value = 'SI123456789012345A';
2700 |
2701 | // Act
2702 | const result = hasValidLength(value);
2703 |
2704 | // Assert
2705 | expect(result).toBeFalsy();
2706 | });
2707 |
2708 | it('should return true when it feeds value with valid country code (SK) first and then numbers and string with length equals 24', () => {
2709 | // Arrange
2710 | const value = 'SK12345678901234567890AB';
2711 |
2712 | // Act
2713 | const result = hasValidLength(value);
2714 |
2715 | // Assert
2716 | expect(result).toBeTruthy();
2717 | });
2718 |
2719 | it('should return false when it feeds value with valid country code (SK) first and then numbers and string with length greater than 24', () => {
2720 | // Arrange
2721 | const value = 'SK12345678901234567890AB1';
2722 |
2723 | // Act
2724 | const result = hasValidLength(value);
2725 |
2726 | // Assert
2727 | expect(result).toBeFalsy();
2728 | });
2729 |
2730 | it('should return false when it feeds value with valid country code (SK) first and then numbers and string with length lower than 24', () => {
2731 | // Arrange
2732 | const value = 'SK12345678901234567890A';
2733 |
2734 | // Act
2735 | const result = hasValidLength(value);
2736 |
2737 | // Assert
2738 | expect(result).toBeFalsy();
2739 | });
2740 |
2741 | it('should return true when it feeds value with valid country code (SM) first and then numbers and string with length equals 27', () => {
2742 | // Arrange
2743 | const value = 'SM12345678901234567890123AB';
2744 |
2745 | // Act
2746 | const result = hasValidLength(value);
2747 |
2748 | // Assert
2749 | expect(result).toBeTruthy();
2750 | });
2751 |
2752 | it('should return false when it feeds value with valid country code (SM) first and then numbers and string with length greater than 27', () => {
2753 | // Arrange
2754 | const value = 'SM12345678901234567890123AB1';
2755 |
2756 | // Act
2757 | const result = hasValidLength(value);
2758 |
2759 | // Assert
2760 | expect(result).toBeFalsy();
2761 | });
2762 |
2763 | it('should return false when it feeds value with valid country code (SM) first and then numbers and string with length lower than 27', () => {
2764 | // Arrange
2765 | const value = 'SM12345678901234567890123A';
2766 |
2767 | // Act
2768 | const result = hasValidLength(value);
2769 |
2770 | // Assert
2771 | expect(result).toBeFalsy();
2772 | });
2773 |
2774 | it('should return true when it feeds value with valid country code (SN) first and then numbers and string with length equals 28', () => {
2775 | // Arrange
2776 | const value = 'SN123456789012345678901234AB';
2777 |
2778 | // Act
2779 | const result = hasValidLength(value);
2780 |
2781 | // Assert
2782 | expect(result).toBeTruthy();
2783 | });
2784 |
2785 | it('should return false when it feeds value with valid country code (SN) first and then numbers and string with length greater than 28', () => {
2786 | // Arrange
2787 | const value = 'SN123456789012345678901234AB1';
2788 |
2789 | // Act
2790 | const result = hasValidLength(value);
2791 |
2792 | // Assert
2793 | expect(result).toBeFalsy();
2794 | });
2795 |
2796 | it('should return false when it feeds value with valid country code (SN) first and then numbers and string with length lower than 28', () => {
2797 | // Arrange
2798 | const value = 'SN123456789012345678901234A';
2799 |
2800 | // Act
2801 | const result = hasValidLength(value);
2802 |
2803 | // Assert
2804 | expect(result).toBeFalsy();
2805 | });
2806 |
2807 | it('should return true when it feeds value with valid country code (ST) first and then numbers and string with length equals 25', () => {
2808 | // Arrange
2809 | const value = 'ST123456789012345678901AB';
2810 |
2811 | // Act
2812 | const result = hasValidLength(value);
2813 |
2814 | // Assert
2815 | expect(result).toBeTruthy();
2816 | });
2817 |
2818 | it('should return false when it feeds value with valid country code (ST) first and then numbers and string with length greater than 25', () => {
2819 | // Arrange
2820 | const value = 'ST123456789012345678901AB1';
2821 |
2822 | // Act
2823 | const result = hasValidLength(value);
2824 |
2825 | // Assert
2826 | expect(result).toBeFalsy();
2827 | });
2828 |
2829 | it('should return false when it feeds value with valid country code (ST) first and then numbers and string with length lower than 25', () => {
2830 | // Arrange
2831 | const value = 'ST123456789012345678901A';
2832 |
2833 | // Act
2834 | const result = hasValidLength(value);
2835 |
2836 | // Assert
2837 | expect(result).toBeFalsy();
2838 | });
2839 |
2840 | it('should return true when it feeds value with valid country code (SV) first and then numbers and string with length equals 28', () => {
2841 | // Arrange
2842 | const value = 'SV123456789012345678901234AB';
2843 |
2844 | // Act
2845 | const result = hasValidLength(value);
2846 |
2847 | // Assert
2848 | expect(result).toBeTruthy();
2849 | });
2850 |
2851 | it('should return false when it feeds value with valid country code (SV) first and then numbers and string with length greater than 28', () => {
2852 | // Arrange
2853 | const value = 'SV123456789012345678901234AB1';
2854 |
2855 | // Act
2856 | const result = hasValidLength(value);
2857 |
2858 | // Assert
2859 | expect(result).toBeFalsy();
2860 | });
2861 |
2862 | it('should return false when it feeds value with valid country code (SV) first and then numbers and string with length lower than 28', () => {
2863 | // Arrange
2864 | const value = 'SV123456789012345678901234A';
2865 |
2866 | // Act
2867 | const result = hasValidLength(value);
2868 |
2869 | // Assert
2870 | expect(result).toBeFalsy();
2871 | });
2872 |
2873 | it('should return true when it feeds value with valid country code (TN) first and then numbers and string with length equals 24', () => {
2874 | // Arrange
2875 | const value = 'TN12345678901234567890AB';
2876 |
2877 | // Act
2878 | const result = hasValidLength(value);
2879 |
2880 | // Assert
2881 | expect(result).toBeTruthy();
2882 | });
2883 |
2884 | it('should return false when it feeds value with valid country code (TN) first and then numbers and string with length greater than 24', () => {
2885 | // Arrange
2886 | const value = 'TN12345678901234567890AB1';
2887 |
2888 | // Act
2889 | const result = hasValidLength(value);
2890 |
2891 | // Assert
2892 | expect(result).toBeFalsy();
2893 | });
2894 |
2895 | it('should return false when it feeds value with valid country code (TN) first and then numbers and string with length lower than 24', () => {
2896 | // Arrange
2897 | const value = 'TN12345678901234567890A';
2898 |
2899 | // Act
2900 | const result = hasValidLength(value);
2901 |
2902 | // Assert
2903 | expect(result).toBeFalsy();
2904 | });
2905 |
2906 | it('should return true when it feeds value with valid country code (TL) first and then numbers and string with length equals 23', () => {
2907 | // Arrange
2908 | const value = 'TL1234567890123456789AB';
2909 |
2910 | // Act
2911 | const result = hasValidLength(value);
2912 |
2913 | // Assert
2914 | expect(result).toBeTruthy();
2915 | });
2916 |
2917 | it('should return false when it feeds value with valid country code (TL) first and then numbers and string with length greater than 23', () => {
2918 | // Arrange
2919 | const value = 'TL1234567890123456789AB1';
2920 |
2921 | // Act
2922 | const result = hasValidLength(value);
2923 |
2924 | // Assert
2925 | expect(result).toBeFalsy();
2926 | });
2927 |
2928 | it('should return false when it feeds value with valid country code (TL) first and then numbers and string with length lower than 23', () => {
2929 | // Arrange
2930 | const value = 'TL1234567890123456789A';
2931 |
2932 | // Act
2933 | const result = hasValidLength(value);
2934 |
2935 | // Assert
2936 | expect(result).toBeFalsy();
2937 | });
2938 |
2939 | it('should return true when it feeds value with valid country code (TR) first and then numbers and string with length equals 26', () => {
2940 | // Arrange
2941 | const value = 'TR1234567890123456789012AB';
2942 |
2943 | // Act
2944 | const result = hasValidLength(value);
2945 |
2946 | // Assert
2947 | expect(result).toBeTruthy();
2948 | });
2949 |
2950 | it('should return false when it feeds value with valid country code (TR) first and then numbers and string with length greater than 26', () => {
2951 | // Arrange
2952 | const value = 'TR1234567890123456789012AB1';
2953 |
2954 | // Act
2955 | const result = hasValidLength(value);
2956 |
2957 | // Assert
2958 | expect(result).toBeFalsy();
2959 | });
2960 |
2961 | it('should return false when it feeds value with valid country code (TR) first and then numbers and string with length lower than 26', () => {
2962 | // Arrange
2963 | const value = 'TR1234567890123456789012A';
2964 |
2965 | // Act
2966 | const result = hasValidLength(value);
2967 |
2968 | // Assert
2969 | expect(result).toBeFalsy();
2970 | });
2971 |
2972 | it('should return true when it feeds value with valid country code (UA) first and then numbers and string with length equals 29', () => {
2973 | // Arrange
2974 | const value = 'UA1234567890123456789012345AB';
2975 |
2976 | // Act
2977 | const result = hasValidLength(value);
2978 |
2979 | // Assert
2980 | expect(result).toBeTruthy();
2981 | });
2982 |
2983 | it('should return false when it feeds value with valid country code (UA) first and then numbers and string with length greater than 29', () => {
2984 | // Arrange
2985 | const value = 'UA1234567890123456789012345AB1';
2986 |
2987 | // Act
2988 | const result = hasValidLength(value);
2989 |
2990 | // Assert
2991 | expect(result).toBeFalsy();
2992 | });
2993 |
2994 | it('should return false when it feeds value with valid country code (UA) first and then numbers and string with length lower than 29', () => {
2995 | // Arrange
2996 | const value = 'UA1234567890123456789012345A';
2997 |
2998 | // Act
2999 | const result = hasValidLength(value);
3000 |
3001 | // Assert
3002 | expect(result).toBeFalsy();
3003 | });
3004 |
3005 | it('should return true when it feeds value with valid country code (VG) first and then numbers and string with length equals 24', () => {
3006 | // Arrange
3007 | const value = 'VG12345678901234567890AB';
3008 |
3009 | // Act
3010 | const result = hasValidLength(value);
3011 |
3012 | // Assert
3013 | expect(result).toBeTruthy();
3014 | });
3015 |
3016 | it('should return false when it feeds value with valid country code (VG) first and then numbers and string with length greater than 24', () => {
3017 | // Arrange
3018 | const value = 'VG12345678901234567890AB1';
3019 |
3020 | // Act
3021 | const result = hasValidLength(value);
3022 |
3023 | // Assert
3024 | expect(result).toBeFalsy();
3025 | });
3026 |
3027 | it('should return false when it feeds value with valid country code (VG) first and then numbers and string with length lower than 24', () => {
3028 | // Arrange
3029 | const value = 'VG12345678901234567890A';
3030 |
3031 | // Act
3032 | const result = hasValidLength(value);
3033 |
3034 | // Assert
3035 | expect(result).toBeFalsy();
3036 | });
3037 |
3038 | it('should return true when it feeds value with valid country code (XK) first and then numbers and string with length equals 20', () => {
3039 | // Arrange
3040 | const value = 'XK1234567890123456AB';
3041 |
3042 | // Act
3043 | const result = hasValidLength(value);
3044 |
3045 | // Assert
3046 | expect(result).toBeTruthy();
3047 | });
3048 |
3049 | it('should return false when it feeds value with valid country code (XK) first and then numbers and string with length greater than 20', () => {
3050 | // Arrange
3051 | const value = 'XK1234567890123456AB1';
3052 |
3053 | // Act
3054 | const result = hasValidLength(value);
3055 |
3056 | // Assert
3057 | expect(result).toBeFalsy();
3058 | });
3059 |
3060 | it('should return false when it feeds value with valid country code (XK) first and then numbers and string with length lower than 20', () => {
3061 | // Arrange
3062 | const value = 'XK1234567890123456A';
3063 |
3064 | // Act
3065 | const result = hasValidLength(value);
3066 |
3067 | // Assert
3068 | expect(result).toBeFalsy();
3069 | });
3070 | });
3071 | });
3072 |
--------------------------------------------------------------------------------