From c70536c79dbfc56e0fe1b1510d1e9b2eac976318 Mon Sep 17 00:00:00 2001 From: Sergei Panfilov Date: Wed, 15 Apr 2020 15:38:59 +0200 Subject: [PATCH] Release v2.3.0 (#98) * bumped version * style fixes * migrated node v10 -> node v13 * updated dependencies * updated contributors * build project's files * Added new flags: "isSupportedCountry" and "isValidFormat" * improved unit tests * fixed test description * (wip) introduced new tests * fixes for the tests * fixes for the tests * fixes for the tests * fixed README.md --- .nvmrc | 2 +- .travis.yml | 2 + README.md | 28 +- lib/amd/lib/jsvat.js | 42 +- lib/commonjs/lib/jsvat.js | 45 +- lib/es6/lib/jsvat.js | 42 +- lib/system/lib/jsvat.js | 42 +- lib/umd/lib/jsvat.js | 42 +- package.json | 9 +- src/lib/jsvat.ts | 52 +- test/austria.spec.js | 18 +- test/belgium.spec.js | 18 +- test/bulgaria.spec.js | 18 +- test/countries_vat_lists/austria.vat.js | 7 + test/countries_vat_lists/belgium.vat.js | 7 + test/countries_vat_lists/bulgaria.vat.js | 7 + test/countries_vat_lists/croatia.vat.js | 7 + test/countries_vat_lists/cyprus.vat.js | 8 + test/countries_vat_lists/czechRepublic.vat.js | 7 + test/countries_vat_lists/denmark.vat.js | 7 + test/countries_vat_lists/estonia.vat.js | 7 + test/countries_vat_lists/europe.vat.js | 7 + test/countries_vat_lists/finland.vat.js | 7 + test/countries_vat_lists/france.vat.js | 7 + test/countries_vat_lists/germany.vat.js | 7 + test/countries_vat_lists/greece.vat.js | 7 + test/countries_vat_lists/hungary.vat.js | 7 + test/countries_vat_lists/ireland.vat.js | 7 + test/countries_vat_lists/italy.vat.js | 7 + test/countries_vat_lists/latvia.vat.js | 7 + test/countries_vat_lists/lithuania.vat.js | 7 + test/countries_vat_lists/luxembourg.vat.js | 7 + test/countries_vat_lists/malta.vat.js | 7 + test/countries_vat_lists/netherlands.vat.js | 7 + test/countries_vat_lists/norway.vat.js | 7 + test/countries_vat_lists/poland.vat.js | 7 + test/countries_vat_lists/portugal.vat.js | 7 + test/countries_vat_lists/romania.vat.js | 7 + test/countries_vat_lists/russia.vat.js | 7 + test/countries_vat_lists/serbia.vat.js | 7 + .../slovakiaRepublic.vat.js | 7 + test/countries_vat_lists/slovenia.vat.js | 7 + test/countries_vat_lists/spain.vat.js | 7 + test/countries_vat_lists/sweden.vat.js | 7 + test/countries_vat_lists/switzerland.vat.js | 7 + test/countries_vat_lists/unitedKingdom.vat.js | 7 + test/croatia.spec.js | 18 +- test/cyprus.spec.js | 18 +- test/czechRepublic.spec.js | 18 +- test/denmark.spec.js | 18 +- test/estonia.spec.js | 18 +- test/europe.spec.js | 19 +- test/finland.spec.js | 18 +- test/france.spec.js | 18 +- test/germany.spec.js | 18 +- test/greece.spec.js | 18 +- test/hungary.spec.js | 18 +- test/ireland.spec.js | 18 +- test/italy.spec.js | 18 +- test/latvia.spec.js | 18 +- test/lithuania.spec.js | 18 +- test/luxembourg.spec.js | 18 +- test/malta.spec.js | 18 +- test/netherlands.spec.js | 18 +- test/norway.spec.js | 18 +- test/poland.spec.js | 18 +- test/portugal.spec.js | 18 +- test/romania.spec.js | 18 +- test/russia.spec.js | 18 +- test/serbia.spec.js | 18 +- test/slovakiaRepublic.spec.js | 18 +- test/slovenia.spec.js | 18 +- test/spain.spec.js | 18 +- test/sweden.spec.js | 18 +- test/switzerland.spec.js | 18 +- test/unitedKingdom.spec.js | 18 +- test/utils.js | 15 +- types/lib/jsvat.d.ts | 6 +- yarn.lock | 650 +++++++++--------- 79 files changed, 1082 insertions(+), 722 deletions(-) diff --git a/.nvmrc b/.nvmrc index 96ea0a1..8e7d30a 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -v10.3.0 \ No newline at end of file +v13.13.0 \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index 42e5b5a..e000ed5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,5 +2,7 @@ language: node_js node_js: - '10' - '11' + - '12' + - '13' notifications: email: false \ No newline at end of file diff --git a/README.md b/README.md index 705fcfa..037f051 100644 --- a/README.md +++ b/README.md @@ -21,20 +21,26 @@ What is it? Small library to check validity VAT numbers (European + some others counties). ([learn more][1] about VAT) -- no dependencies; -- no http calls; +- No dependencies; +- No http calls; - 2-step checks: math + regexp; -- tree-shakeable; -- extendable; -- dynamically add/remove countries with which you want to check the VAT; -- written in `typescript`; +- Tree-shakeable; +- Extendable; +- Separate checks for valid VAT and valid VAT format; +- Dynamically add/remove countries with which you want to check the VAT; +- Detecting possible country before you finish; +- Typescript; Installation ---------- Installation: - `npm i jsvat --save` or `yarn add jsvat` + ```bash + npm i jsvat --save + ``` + +(or `yarn add jsvat`) For legacy versions (below v2.0.0) also possible: Bower: `bower i jsvat --save` @@ -52,14 +58,16 @@ Getting Started Return value --------- -`checkVAT()` returns a `Result` Object: +`checkVAT()` returns `VatCheckResult` object: ```typescript export interface VatCheckResult { value?: string; // 'BE0411905847': your VAT without extra characters (like '-', spaces, etc) - isValid: boolean; // main result - is VAT correct against provided countries or not - country?: { // VAT's couuntry (null if not found) + isValid: boolean; // The main result. Indicates if VAT is correct against provided countries or not + isValidFormat: boolean; // Indicates the validation of the format of VAT only. E.g. "BE0411905847" is a valid VAT, and "BE0897221791" is not. But they both has valid format, so "isValidFormat" will return "true" + isSupportedCountry: boolean; // Indicates if "jsvat" could recognize the VAT. Sometimes you want to understand - if it's an invalid VAT from supported country or from an unknown one + country?: { // VAT's country (null if not found). By "supported" I mean imported. name: string; // ISO country name of VAT isoCode: { // Country ISO codes short: string; diff --git a/lib/amd/lib/jsvat.js b/lib/amd/lib/jsvat.js index efb950b..6346628 100644 --- a/lib/amd/lib/jsvat.js +++ b/lib/amd/lib/jsvat.js @@ -5,41 +5,38 @@ define(["require", "exports"], function (require, exports) { return { value: vat || undefined, isValid: Boolean(isValid), + isValidFormat: country ? isVatValidToRegexp(vat, country.rules.regex).isValid : false, + isSupportedCountry: Boolean(country), country: (!country) ? undefined : { name: country.name, isoCode: { short: country.codes[0], long: country.codes[1], numeric: country.codes[2] - }, - formatValid: country.formatValid, + } } }; } function removeExtraChars(vat = '') { return vat.toString().toUpperCase().replace(/(\s|-|\.)+/g, ''); } - function getCountryCode(country) { - if (country.name === 'Greece') { - return 'EL'; - } - else { - return country.codes[0]; - } + function getCountryCodes(country) { + return ([ + ...country.codes, + (country.name === 'Greece') ? 'EL' : undefined + ]).filter(Boolean); } function getCountry(vat, countriesList) { for (const country of countriesList) { - const countryCode = getCountryCode(country); - if (vat.startsWith(countryCode)) { - const formatValid = isVatValidToRegexp(vat, country.rules.regex); - return { - ...country, - formatValid: formatValid.isValid - }; - } + if (startsWithCode(vat, country)) + return { ...country }; } return undefined; } + function startsWithCode(vat, country) { + const countryCodes = getCountryCodes(country); + return countryCodes.filter(code => vat.startsWith(code)).length > 0; + } function isVatValidToRegexp(vat, regexArr) { for (const regex of regexArr) { const isValid = regex.test(vat); @@ -61,16 +58,9 @@ define(["require", "exports"], function (require, exports) { if (!vat) return makeResult(vat, false); const cleanVAT = removeExtraChars(vat); - const result = makeResult(cleanVAT); const country = getCountry(cleanVAT, countriesList); - if (!country) - return result; - if (!country.formatValid) - return makeResult(cleanVAT, country.formatValid, country); - const isValid = isVatValid(cleanVAT, country); - if (isValid) - return makeResult(cleanVAT, isValid, country); - return result; + const isValid = (country) ? isVatValid(cleanVAT, country) : false; + return makeResult(cleanVAT, isValid, country); } exports.checkVAT = checkVAT; }); diff --git a/lib/commonjs/lib/jsvat.js b/lib/commonjs/lib/jsvat.js index 9b168d5..e4a2a5f 100644 --- a/lib/commonjs/lib/jsvat.js +++ b/lib/commonjs/lib/jsvat.js @@ -10,19 +10,27 @@ var __assign = (this && this.__assign) || function () { }; return __assign.apply(this, arguments); }; +var __spreadArrays = (this && this.__spreadArrays) || function () { + for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; + for (var r = Array(s), k = 0, i = 0; i < il; i++) + for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) + r[k] = a[j]; + return r; +}; Object.defineProperty(exports, "__esModule", { value: true }); function makeResult(vat, isValid, country) { return { value: vat || undefined, isValid: Boolean(isValid), + isValidFormat: country ? isVatValidToRegexp(vat, country.rules.regex).isValid : false, + isSupportedCountry: Boolean(country), country: (!country) ? undefined : { name: country.name, isoCode: { short: country.codes[0], long: country.codes[1], numeric: country.codes[2] - }, - formatValid: country.formatValid, + } } }; } @@ -30,25 +38,23 @@ function removeExtraChars(vat) { if (vat === void 0) { vat = ''; } return vat.toString().toUpperCase().replace(/(\s|-|\.)+/g, ''); } -function getCountryCode(country) { - if (country.name === 'Greece') { - return 'EL'; - } - else { - return country.codes[0]; - } +function getCountryCodes(country) { + return (__spreadArrays(country.codes, [ + (country.name === 'Greece') ? 'EL' : undefined + ])).filter(Boolean); } function getCountry(vat, countriesList) { for (var _i = 0, countriesList_1 = countriesList; _i < countriesList_1.length; _i++) { var country = countriesList_1[_i]; - var countryCode = getCountryCode(country); - if (vat.startsWith(countryCode)) { - var formatValid = isVatValidToRegexp(vat, country.rules.regex); - return __assign(__assign({}, country), { formatValid: formatValid.isValid }); - } + if (startsWithCode(vat, country)) + return __assign({}, country); } return undefined; } +function startsWithCode(vat, country) { + var countryCodes = getCountryCodes(country); + return countryCodes.filter(function (code) { return vat.startsWith(code); }).length > 0; +} function isVatValidToRegexp(vat, regexArr) { for (var _i = 0, regexArr_1 = regexArr; _i < regexArr_1.length; _i++) { var regex = regexArr_1[_i]; @@ -72,15 +78,8 @@ function checkVAT(vat, countriesList) { if (!vat) return makeResult(vat, false); var cleanVAT = removeExtraChars(vat); - var result = makeResult(cleanVAT); var country = getCountry(cleanVAT, countriesList); - if (!country) - return result; - if (!country.formatValid) - return makeResult(cleanVAT, country.formatValid, country); - var isValid = isVatValid(cleanVAT, country); - if (isValid) - return makeResult(cleanVAT, isValid, country); - return result; + var isValid = (country) ? isVatValid(cleanVAT, country) : false; + return makeResult(cleanVAT, isValid, country); } exports.checkVAT = checkVAT; diff --git a/lib/es6/lib/jsvat.js b/lib/es6/lib/jsvat.js index 821c8d6..6669408 100644 --- a/lib/es6/lib/jsvat.js +++ b/lib/es6/lib/jsvat.js @@ -2,41 +2,38 @@ function makeResult(vat, isValid, country) { return { value: vat || undefined, isValid: Boolean(isValid), + isValidFormat: country ? isVatValidToRegexp(vat, country.rules.regex).isValid : false, + isSupportedCountry: Boolean(country), country: (!country) ? undefined : { name: country.name, isoCode: { short: country.codes[0], long: country.codes[1], numeric: country.codes[2] - }, - formatValid: country.formatValid, + } } }; } function removeExtraChars(vat = '') { return vat.toString().toUpperCase().replace(/(\s|-|\.)+/g, ''); } -function getCountryCode(country) { - if (country.name === 'Greece') { - return 'EL'; - } - else { - return country.codes[0]; - } +function getCountryCodes(country) { + return ([ + ...country.codes, + (country.name === 'Greece') ? 'EL' : undefined + ]).filter(Boolean); } function getCountry(vat, countriesList) { for (const country of countriesList) { - const countryCode = getCountryCode(country); - if (vat.startsWith(countryCode)) { - const formatValid = isVatValidToRegexp(vat, country.rules.regex); - return { - ...country, - formatValid: formatValid.isValid - }; - } + if (startsWithCode(vat, country)) + return { ...country }; } return undefined; } +function startsWithCode(vat, country) { + const countryCodes = getCountryCodes(country); + return countryCodes.filter(code => vat.startsWith(code)).length > 0; +} function isVatValidToRegexp(vat, regexArr) { for (const regex of regexArr) { const isValid = regex.test(vat); @@ -58,14 +55,7 @@ export function checkVAT(vat, countriesList = []) { if (!vat) return makeResult(vat, false); const cleanVAT = removeExtraChars(vat); - const result = makeResult(cleanVAT); const country = getCountry(cleanVAT, countriesList); - if (!country) - return result; - if (!country.formatValid) - return makeResult(cleanVAT, country.formatValid, country); - const isValid = isVatValid(cleanVAT, country); - if (isValid) - return makeResult(cleanVAT, isValid, country); - return result; + const isValid = (country) ? isVatValid(cleanVAT, country) : false; + return makeResult(cleanVAT, isValid, country); } diff --git a/lib/system/lib/jsvat.js b/lib/system/lib/jsvat.js index b593eb7..4941be8 100644 --- a/lib/system/lib/jsvat.js +++ b/lib/system/lib/jsvat.js @@ -5,41 +5,38 @@ System.register([], function (exports_1, context_1) { return { value: vat || undefined, isValid: Boolean(isValid), + isValidFormat: country ? isVatValidToRegexp(vat, country.rules.regex).isValid : false, + isSupportedCountry: Boolean(country), country: (!country) ? undefined : { name: country.name, isoCode: { short: country.codes[0], long: country.codes[1], numeric: country.codes[2] - }, - formatValid: country.formatValid, + } } }; } function removeExtraChars(vat = '') { return vat.toString().toUpperCase().replace(/(\s|-|\.)+/g, ''); } - function getCountryCode(country) { - if (country.name === 'Greece') { - return 'EL'; - } - else { - return country.codes[0]; - } + function getCountryCodes(country) { + return ([ + ...country.codes, + (country.name === 'Greece') ? 'EL' : undefined + ]).filter(Boolean); } function getCountry(vat, countriesList) { for (const country of countriesList) { - const countryCode = getCountryCode(country); - if (vat.startsWith(countryCode)) { - const formatValid = isVatValidToRegexp(vat, country.rules.regex); - return { - ...country, - formatValid: formatValid.isValid - }; - } + if (startsWithCode(vat, country)) + return { ...country }; } return undefined; } + function startsWithCode(vat, country) { + const countryCodes = getCountryCodes(country); + return countryCodes.filter(code => vat.startsWith(code)).length > 0; + } function isVatValidToRegexp(vat, regexArr) { for (const regex of regexArr) { const isValid = regex.test(vat); @@ -61,16 +58,9 @@ System.register([], function (exports_1, context_1) { if (!vat) return makeResult(vat, false); const cleanVAT = removeExtraChars(vat); - const result = makeResult(cleanVAT); const country = getCountry(cleanVAT, countriesList); - if (!country) - return result; - if (!country.formatValid) - return makeResult(cleanVAT, country.formatValid, country); - const isValid = isVatValid(cleanVAT, country); - if (isValid) - return makeResult(cleanVAT, isValid, country); - return result; + const isValid = (country) ? isVatValid(cleanVAT, country) : false; + return makeResult(cleanVAT, isValid, country); } exports_1("checkVAT", checkVAT); return { diff --git a/lib/umd/lib/jsvat.js b/lib/umd/lib/jsvat.js index e0dd9e6..f47385f 100644 --- a/lib/umd/lib/jsvat.js +++ b/lib/umd/lib/jsvat.js @@ -13,41 +13,38 @@ return { value: vat || undefined, isValid: Boolean(isValid), + isValidFormat: country ? isVatValidToRegexp(vat, country.rules.regex).isValid : false, + isSupportedCountry: Boolean(country), country: (!country) ? undefined : { name: country.name, isoCode: { short: country.codes[0], long: country.codes[1], numeric: country.codes[2] - }, - formatValid: country.formatValid, + } } }; } function removeExtraChars(vat = '') { return vat.toString().toUpperCase().replace(/(\s|-|\.)+/g, ''); } - function getCountryCode(country) { - if (country.name === 'Greece') { - return 'EL'; - } - else { - return country.codes[0]; - } + function getCountryCodes(country) { + return ([ + ...country.codes, + (country.name === 'Greece') ? 'EL' : undefined + ]).filter(Boolean); } function getCountry(vat, countriesList) { for (const country of countriesList) { - const countryCode = getCountryCode(country); - if (vat.startsWith(countryCode)) { - const formatValid = isVatValidToRegexp(vat, country.rules.regex); - return { - ...country, - formatValid: formatValid.isValid - }; - } + if (startsWithCode(vat, country)) + return { ...country }; } return undefined; } + function startsWithCode(vat, country) { + const countryCodes = getCountryCodes(country); + return countryCodes.filter(code => vat.startsWith(code)).length > 0; + } function isVatValidToRegexp(vat, regexArr) { for (const regex of regexArr) { const isValid = regex.test(vat); @@ -69,16 +66,9 @@ if (!vat) return makeResult(vat, false); const cleanVAT = removeExtraChars(vat); - const result = makeResult(cleanVAT); const country = getCountry(cleanVAT, countriesList); - if (!country) - return result; - if (!country.formatValid) - return makeResult(cleanVAT, country.formatValid, country); - const isValid = isVatValid(cleanVAT, country); - if (isValid) - return makeResult(cleanVAT, isValid, country); - return result; + const isValid = (country) ? isVatValid(cleanVAT, country) : false; + return makeResult(cleanVAT, isValid, country); } exports.checkVAT = checkVAT; }); diff --git a/package.json b/package.json index 5cf7075..a1286db 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "jsvat", - "version": "2.2.0", + "version": "2.3.0", "description": "Check the validity of the format of an EU VAT number", "main": "./lib/commonjs/index.js", "module": "./lib/es6/index.js", @@ -46,15 +46,18 @@ ], "ignore": {}, "author": "S.Panfilov (https://se-panfilov.github.io)", + "contributors": [ + "Wilgert Velinga (http://wilgert.nl)" + ], "private": false, "dependencies": {}, "devDependencies": { "@babel/preset-env": "7.9.5", "babel": "6.23.0", "babel-plugin-transform-es2015-modules-commonjs": "6.26.2", - "jest": "25.2.7", + "jest": "25.3.0", "rimraf": "3.0.2", - "ts-loader": "6.2.2", + "ts-loader": "7.0.0", "tslint": "6.1.1", "tslint-config-prettier": "1.18.0", "tslint-immutable": "6.0.1", diff --git a/src/lib/jsvat.ts b/src/lib/jsvat.ts index b7eef14..1c95e66 100644 --- a/src/lib/jsvat.ts +++ b/src/lib/jsvat.ts @@ -18,32 +18,30 @@ export interface Country { rules: Rules; } -export interface CountryWithFormatValid extends Country { - formatValid: boolean; -} - export interface VatCheckResult { value?: string; isValid: boolean; + isValidFormat: boolean; + isSupportedCountry: boolean; country?: { name: string, isoCode: { short: string, long: string, numeric: string } - formatValid: boolean }; } -function makeResult(vat: string, isValid?: boolean, country?: CountryWithFormatValid): VatCheckResult { +function makeResult(vat: string, isValid?: boolean, country?: Country): VatCheckResult { return { value: vat || undefined, isValid: Boolean(isValid), + isValidFormat: country ? isVatValidToRegexp(vat, country.rules.regex).isValid : false, + isSupportedCountry: Boolean(country), country: (!country) ? undefined : { name: country.name, isoCode: { short: country.codes[0], long: country.codes[1], numeric: country.codes[2] - }, - formatValid: country.formatValid, + } } }; } @@ -52,28 +50,25 @@ function removeExtraChars(vat: string = ''): string { return vat.toString().toUpperCase().replace(/(\s|-|\.)+/g, ''); } -function getCountryCode(country: Country): string { - if (country.name === 'Greece') { - return 'EL'; - } else { - return country.codes[0]; - } +function getCountryCodes(country: Country): ReadonlyArray { + return ([ + ...country.codes, + (country.name === 'Greece') ? 'EL' : undefined + ]).filter(Boolean) as ReadonlyArray; } -function getCountry(vat: string, countriesList: ReadonlyArray): CountryWithFormatValid | undefined { +function getCountry(vat: string, countriesList: ReadonlyArray): Country | undefined { for (const country of countriesList) { - const countryCode = getCountryCode(country); - if (vat.startsWith(countryCode)) { - const formatValid = isVatValidToRegexp(vat, country.rules.regex); - return { - ...country, - formatValid: formatValid.isValid - }; - } + if (startsWithCode(vat, country)) return { ...country }; } return undefined; } +function startsWithCode(vat: string, country: Country): boolean { + const countryCodes = getCountryCodes(country); + return countryCodes.filter(code => vat.startsWith(code)).length > 0; +} + function isVatValidToRegexp(vat: string, regexArr: ReadonlyArray): { isValid: boolean, regex?: RegExp } { for (const regex of regexArr) { const isValid = regex.test(vat); @@ -94,15 +89,8 @@ function isVatValid(vat: string, country: Country): boolean { export function checkVAT(vat: string, countriesList: ReadonlyArray = []): VatCheckResult { if (!vat) return makeResult(vat, false); const cleanVAT = removeExtraChars(vat); - const result = makeResult(cleanVAT); const country = getCountry(cleanVAT, countriesList); - if (!country) return result; - if (!country.formatValid) return makeResult(cleanVAT, country.formatValid, country) - - const isValid = isVatValid(cleanVAT, country); - - if (isValid) return makeResult(cleanVAT, isValid, country); - - return result; + const isValid = (country) ? isVatValid(cleanVAT, country) : false; + return makeResult(cleanVAT, isValid, country); } diff --git a/test/austria.spec.js b/test/austria.spec.js index 89cfa1c..f42fafe 100644 --- a/test/austria.spec.js +++ b/test/austria.spec.js @@ -1,27 +1,31 @@ import { austria } from '../index' -import { codes, invalid, name, valid } from './countries_vat_lists/austria.vat' -import { addCharsToString, checkInValidVat, checkValidVat } from './utils' +import { codes, invalid, name, valid, validOnlyByFormat } from './countries_vat_lists/austria.vat' +import { addCharsToString, checkInvalidVat, checkOnlyValidFormatVat, checkValidVat } from './utils' describe('Austria', () => { - it('should return true result for valid VATs', () => { + it('should return "true" result for valid VATs', () => { valid.forEach(vat => checkValidVat(vat, [austria], codes, name)) }) + + it('should return "true" for "isSupportedCountry" and "isValidFormat" fields, but "false" for "isValid" for VATs that match format but still invalid', () => { + validOnlyByFormat.forEach(vat => checkOnlyValidFormatVat(vat, [austria], codes, name)) + }) - it('should return true result for valid VATs with extra dash characters', () => { + it('should return "true" result for valid VATs with extra dash characters', () => { valid .map(vat => addCharsToString(vat, '-')) .forEach(vat => checkValidVat(vat, [austria], codes, name)) }) - it('should return true result for valid VATs with extra space characters', () => { + it('should return "true" result for valid VATs with extra space characters', () => { valid .map(vat => addCharsToString(vat, ' ')) .forEach(vat => checkValidVat(vat, [austria], codes, name)) }) - it('should return false result for invalid VATs', () => { - invalid.forEach(vat => checkInValidVat(vat, [austria])) + it('should return "false" result for invalid VATs', () => { + invalid.forEach(vat => checkInvalidVat(vat, [austria])) }) }) diff --git a/test/belgium.spec.js b/test/belgium.spec.js index 7e040b1..4999931 100644 --- a/test/belgium.spec.js +++ b/test/belgium.spec.js @@ -1,27 +1,31 @@ import { belgium } from '../index' -import { codes, invalid, name, valid } from './countries_vat_lists/belgium.vat' -import { addCharsToString, checkInValidVat, checkValidVat } from './utils' +import { codes, invalid, name, valid, validOnlyByFormat } from './countries_vat_lists/belgium.vat' +import { addCharsToString, checkInvalidVat, checkOnlyValidFormatVat, checkValidVat } from './utils' describe('Belgium', () => { - it('should return true result for valid VATs', () => { + it('should return "true" result for valid VATs', () => { valid.forEach(vat => checkValidVat(vat, [belgium], codes, name)) }) - it('should return true result for valid VATs with extra dash characters', () => { + it('should return "true" for "isSupportedCountry" and "isValidFormat" fields, but "false" for "isValid" for VATs that match format but still invalid', () => { + validOnlyByFormat.forEach(vat => checkOnlyValidFormatVat(vat, [belgium], codes, name)) + }) + + it('should return "true" result for valid VATs with extra dash characters', () => { valid .map(vat => addCharsToString(vat, '-')) .forEach(vat => checkValidVat(vat, [belgium], codes, name)) }) - it('should return true result for valid VATs with extra space characters', () => { + it('should return "true" result for valid VATs with extra space characters', () => { valid .map(vat => addCharsToString(vat, ' ')) .forEach(vat => checkValidVat(vat, [belgium], codes, name)) }) - it('should return false result for invalid VATs', () => { - invalid.forEach(vat => checkInValidVat(vat, [belgium])) + it('should return "false" result for invalid VATs', () => { + invalid.forEach(vat => checkInvalidVat(vat, [belgium])) }) }) diff --git a/test/bulgaria.spec.js b/test/bulgaria.spec.js index 144de54..5fac539 100644 --- a/test/bulgaria.spec.js +++ b/test/bulgaria.spec.js @@ -1,27 +1,31 @@ import { bulgaria } from '../index' -import { codes, invalid, name, valid } from './countries_vat_lists/bulgaria.vat' -import { addCharsToString, checkInValidVat, checkValidVat } from './utils' +import { codes, invalid, name, valid, validOnlyByFormat } from './countries_vat_lists/bulgaria.vat' +import { addCharsToString, checkInvalidVat, checkOnlyValidFormatVat, checkValidVat } from './utils' describe('Bulgaria', () => { - it('should return true result for valid VATs', () => { + it('should return "true" result for valid VATs', () => { valid.forEach(vat => checkValidVat(vat, [bulgaria], codes, name)) }) - it('should return true result for valid VATs with extra dash characters', () => { + it('should return "true" for "isSupportedCountry" and "isValidFormat" fields, but "false" for "isValid" for VATs that match format but still invalid', () => { + validOnlyByFormat.forEach(vat => checkOnlyValidFormatVat(vat, [bulgaria], codes, name)) + }) + + it('should return "true" result for valid VATs with extra dash characters', () => { valid .map(vat => addCharsToString(vat, '-')) .forEach(vat => checkValidVat(vat, [bulgaria], codes, name)) }) - it('should return true result for valid VATs with extra space characters', () => { + it('should return "true" result for valid VATs with extra space characters', () => { valid .map(vat => addCharsToString(vat, ' ')) .forEach(vat => checkValidVat(vat, [bulgaria], codes, name)) }) - it('should return false result for invalid VATs', () => { - invalid.forEach(vat => checkInValidVat(vat, [bulgaria])) + it('should return "false" result for invalid VATs', () => { + invalid.forEach(vat => checkInvalidVat(vat, [bulgaria])) }) }) diff --git a/test/countries_vat_lists/austria.vat.js b/test/countries_vat_lists/austria.vat.js index e5993f3..db49734 100644 --- a/test/countries_vat_lists/austria.vat.js +++ b/test/countries_vat_lists/austria.vat.js @@ -66,6 +66,13 @@ export const valid = [ 'ATU66889218' ] +export const validOnlyByFormat = [ + 'ATU00000000', + 'ATU00000001', + 'ATU00000002', + 'ATU00000003' +] + export const invalid = [ 'ATV66889218', 'ATU10223001', diff --git a/test/countries_vat_lists/belgium.vat.js b/test/countries_vat_lists/belgium.vat.js index e2cf8f5..c5f42df 100644 --- a/test/countries_vat_lists/belgium.vat.js +++ b/test/countries_vat_lists/belgium.vat.js @@ -211,6 +211,13 @@ export const valid = [ 'BE897231984' ] +export const validOnlyByFormat = [ + 'BE000000000', + 'BE000000001', + 'BE000000002', + 'BE000000003' +] + export const invalid = [ 'BE897221791', 'BE0897221791', diff --git a/test/countries_vat_lists/bulgaria.vat.js b/test/countries_vat_lists/bulgaria.vat.js index 4030c14..457086c 100644 --- a/test/countries_vat_lists/bulgaria.vat.js +++ b/test/countries_vat_lists/bulgaria.vat.js @@ -58,6 +58,13 @@ export const valid = [ 'BG9902280002' ] +export const validOnlyByFormat = [ + 'BG800000000', + 'BG800000001', + 'BG800000002', + 'BG800000003' +] + export const invalid = [ 'BG101004509', 'BG101004507', diff --git a/test/countries_vat_lists/croatia.vat.js b/test/countries_vat_lists/croatia.vat.js index de339ba..c11e2b1 100644 --- a/test/countries_vat_lists/croatia.vat.js +++ b/test/countries_vat_lists/croatia.vat.js @@ -48,6 +48,13 @@ export const valid = [ 'HR97405527203' ] +export const validOnlyByFormat = [ + 'HR90000000000', + 'HR90000000001', + 'HR90000000003', + 'HR90000000004' +] + export const invalid = [ 'HR9363442948', 'HR93634429488', diff --git a/test/countries_vat_lists/cyprus.vat.js b/test/countries_vat_lists/cyprus.vat.js index 8756f54..c8e07cf 100644 --- a/test/countries_vat_lists/cyprus.vat.js +++ b/test/countries_vat_lists/cyprus.vat.js @@ -44,6 +44,14 @@ export const valid = [ 'CY99000027S', 'CY99200002N' ] + +export const validOnlyByFormat = [ + 'CY12000000C', + 'CY12000001C', + 'CY12000002C', + 'CY12000003C' +] + export const invalid = [ 'CY0', 'CY00000000W', diff --git a/test/countries_vat_lists/czechRepublic.vat.js b/test/countries_vat_lists/czechRepublic.vat.js index 98675bb..86e0d38 100644 --- a/test/countries_vat_lists/czechRepublic.vat.js +++ b/test/countries_vat_lists/czechRepublic.vat.js @@ -105,6 +105,13 @@ export const valid = [ 'CZ6353050473' ] +export const validOnlyByFormat = [ + 'CZ0000000001', + 'CZ0000000002', + 'CZ0000000003', + 'CZ0000000004' +] + export const invalid = [ 'CZ699001237', 'CZ2758975', diff --git a/test/countries_vat_lists/denmark.vat.js b/test/countries_vat_lists/denmark.vat.js index 89f859b..49bc920 100644 --- a/test/countries_vat_lists/denmark.vat.js +++ b/test/countries_vat_lists/denmark.vat.js @@ -52,6 +52,13 @@ export const valid = [ 'DK78805218' ] +export const validOnlyByFormat = [ + 'DK10000000', + 'DK10000001', + 'DK10000002', + 'DK10000003' +] + export const invalid = [ 'DK10000000', 'DK10000010', diff --git a/test/countries_vat_lists/estonia.vat.js b/test/countries_vat_lists/estonia.vat.js index 8e3e932..e2eae46 100644 --- a/test/countries_vat_lists/estonia.vat.js +++ b/test/countries_vat_lists/estonia.vat.js @@ -52,6 +52,13 @@ export const valid = [ 'EE101589064' ] +export const validOnlyByFormat = [ + 'EE100000000', + 'EE100000001', + 'EE100000002', + 'EE100000003' +] + export const invalid = [ 'EE000207418', 'EE110207418' diff --git a/test/countries_vat_lists/europe.vat.js b/test/countries_vat_lists/europe.vat.js index 4f2b7b3..d124cd0 100644 --- a/test/countries_vat_lists/europe.vat.js +++ b/test/countries_vat_lists/europe.vat.js @@ -8,6 +8,13 @@ export const valid = [ 'EU826001142' ] +export const validOnlyByFormat = [ + 'EU000000000', + 'EU000000001', + 'EU000000002', + 'EU000000003' +] + export const invalid = [ 'EU123456', 'EU1234567', diff --git a/test/countries_vat_lists/finland.vat.js b/test/countries_vat_lists/finland.vat.js index e8b75cf..bb725db 100644 --- a/test/countries_vat_lists/finland.vat.js +++ b/test/countries_vat_lists/finland.vat.js @@ -49,6 +49,13 @@ export const valid = [ 'FI24710461' ] +export const validOnlyByFormat = [ + 'FI00000023', + 'FI00000024', + 'FI00000025', + 'FI00000026' +] + export const invalid = [ 'FI09853601', 'FI00000023', diff --git a/test/countries_vat_lists/france.vat.js b/test/countries_vat_lists/france.vat.js index 785052f..9d43093 100644 --- a/test/countries_vat_lists/france.vat.js +++ b/test/countries_vat_lists/france.vat.js @@ -73,6 +73,13 @@ export const valid = [ 'FRAB012345678' ] +export const validOnlyByFormat = [ + 'FR00000000000', + 'FR00000000001', + 'FR00000000002', + 'FR00000000003' +] + export const invalid = [ 'FR00300076967', 'FR90000000027', diff --git a/test/countries_vat_lists/germany.vat.js b/test/countries_vat_lists/germany.vat.js index c776aa9..175bd12 100644 --- a/test/countries_vat_lists/germany.vat.js +++ b/test/countries_vat_lists/germany.vat.js @@ -45,6 +45,13 @@ export const valid = [ 'DE813495425' ] +export const validOnlyByFormat = [ + 'DE200000001', + 'DE200000002', + 'DE200000003', + 'DE200000004' +] + export const invalid = [ 'DE111111126', 'DE111111127', diff --git a/test/countries_vat_lists/greece.vat.js b/test/countries_vat_lists/greece.vat.js index 0f9d751..2c8aafa 100644 --- a/test/countries_vat_lists/greece.vat.js +++ b/test/countries_vat_lists/greece.vat.js @@ -51,6 +51,13 @@ export const valid = [ 'EL998920231' ] +export const validOnlyByFormat = [ + 'EL000000022', + 'EL000000023', + 'EL000000026', + 'EL000000025' +] + export const invalid = [ 'EL000000022', 'EL000000032', diff --git a/test/countries_vat_lists/hungary.vat.js b/test/countries_vat_lists/hungary.vat.js index dbe58da..66e8f3c 100644 --- a/test/countries_vat_lists/hungary.vat.js +++ b/test/countries_vat_lists/hungary.vat.js @@ -55,6 +55,13 @@ export const valid = [ 'HU65730980' ] +export const validOnlyByFormat = [ + 'HU00000001', + 'HU00000002', + 'HU00000003', + 'HU00000004' +] + export const invalid = [ 'HU65730981', 'HU65731980' diff --git a/test/countries_vat_lists/ireland.vat.js b/test/countries_vat_lists/ireland.vat.js index b34f1d1..576b340 100644 --- a/test/countries_vat_lists/ireland.vat.js +++ b/test/countries_vat_lists/ireland.vat.js @@ -78,6 +78,13 @@ export const valid = [ 'IE3214048CH' ] +export const validOnlyByFormat = [ + 'IE0000000H', + 'IE0000001H', + 'IE0000002H', + 'IE0000003H' +] + export const invalid = [ 'IE87654321SA', 'IE8Z49289A', diff --git a/test/countries_vat_lists/italy.vat.js b/test/countries_vat_lists/italy.vat.js index 9ffc5ef..e166992 100644 --- a/test/countries_vat_lists/italy.vat.js +++ b/test/countries_vat_lists/italy.vat.js @@ -63,6 +63,13 @@ export const valid = [ 'IT01709820995' ] +export const validOnlyByFormat = [ + 'IT00000000000', + 'IT00000000001', + 'IT00000000002', + 'IT00000000003' +] + export const invalid = [ 'IT00000010210', 'IT10000100010', diff --git a/test/countries_vat_lists/latvia.vat.js b/test/countries_vat_lists/latvia.vat.js index 2adc4ba..af6f117 100644 --- a/test/countries_vat_lists/latvia.vat.js +++ b/test/countries_vat_lists/latvia.vat.js @@ -52,6 +52,13 @@ export const valid = [ 'LV90002573483' ] +export const validOnlyByFormat = [ + 'LV50000000000', + 'LV50000000001', + 'LV50000000003', + 'LV50000000004' +] + export const invalid = [ 'LV90001234567', 'LV12345234567', diff --git a/test/countries_vat_lists/lithuania.vat.js b/test/countries_vat_lists/lithuania.vat.js index 23c85b5..2d1b0fa 100644 --- a/test/countries_vat_lists/lithuania.vat.js +++ b/test/countries_vat_lists/lithuania.vat.js @@ -62,6 +62,13 @@ export const valid = [ 'LT907560811' ] +export const validOnlyByFormat = [ + 'LT000000000', + 'LT000000001', + 'LT000000002', + 'LT000000003' +] + export const invalid = [ 'LT123456789', 'LT1234567890', diff --git a/test/countries_vat_lists/luxembourg.vat.js b/test/countries_vat_lists/luxembourg.vat.js index 66db4ff..c75e500 100644 --- a/test/countries_vat_lists/luxembourg.vat.js +++ b/test/countries_vat_lists/luxembourg.vat.js @@ -50,6 +50,13 @@ export const valid = [ 'LU25318872' ] +export const validOnlyByFormat = [ + 'LU20000000', + 'LU20000001', + 'LU20000002', + 'LU20000003' +] + export const invalid = [ 'LU10000350', 'LU00000200', diff --git a/test/countries_vat_lists/malta.vat.js b/test/countries_vat_lists/malta.vat.js index b31125e..2f38d84 100644 --- a/test/countries_vat_lists/malta.vat.js +++ b/test/countries_vat_lists/malta.vat.js @@ -49,6 +49,13 @@ export const valid = [ 'MT20973507' ] +export const validOnlyByFormat = [ + 'MT10000001', + 'MT10000002', + 'MT10000003', + 'MT20000004' +] + export const invalid = [ 'MT2039051', 'MT20390515' diff --git a/test/countries_vat_lists/netherlands.vat.js b/test/countries_vat_lists/netherlands.vat.js index c27203a..cd95d99 100644 --- a/test/countries_vat_lists/netherlands.vat.js +++ b/test/countries_vat_lists/netherlands.vat.js @@ -52,6 +52,13 @@ export const valid = [ 'NL123456789B13' ] +export const validOnlyByFormat = [ + 'NL010000445B01', + 'NL010000445B02', + 'NL010000445B03', + 'NL010000445B04' +] + export const invalid = [ 'NL010000445B01', 'NL000000025B01', diff --git a/test/countries_vat_lists/norway.vat.js b/test/countries_vat_lists/norway.vat.js index c5aec45..8307bff 100644 --- a/test/countries_vat_lists/norway.vat.js +++ b/test/countries_vat_lists/norway.vat.js @@ -54,6 +54,13 @@ export const valid = [ 'NO999600476' ] +export const validOnlyByFormat = [ + 'NO962209011', + 'NO962209012', + 'NO962209013', + 'NO962209014' +] + export const invalid = [ 'NO96220901', 'NO962209018' diff --git a/test/countries_vat_lists/poland.vat.js b/test/countries_vat_lists/poland.vat.js index 5ef3d00..16c4a45 100644 --- a/test/countries_vat_lists/poland.vat.js +++ b/test/countries_vat_lists/poland.vat.js @@ -49,6 +49,13 @@ export const valid = [ 'PL9691068493' ] +export const validOnlyByFormat = [ + 'PL7000000000', + 'PL7000000001', + 'PL7000000002', + 'PL7000000003' +] + export const invalid = [ 'PL7122913628', 'PL7122913427' diff --git a/test/countries_vat_lists/portugal.vat.js b/test/countries_vat_lists/portugal.vat.js index f1b91e4..b43b924 100644 --- a/test/countries_vat_lists/portugal.vat.js +++ b/test/countries_vat_lists/portugal.vat.js @@ -51,6 +51,13 @@ export const valid = [ 'PT980405319' ] +export const validOnlyByFormat = [ + 'PT100000012', + 'PT100000013', + 'PT100000014', + 'PT100000015' +] + export const invalid = [ 'PT502757192', 'PT100000012', diff --git a/test/countries_vat_lists/romania.vat.js b/test/countries_vat_lists/romania.vat.js index 3b1e13c..b638956 100644 --- a/test/countries_vat_lists/romania.vat.js +++ b/test/countries_vat_lists/romania.vat.js @@ -63,6 +63,13 @@ export const valid = [ 'RO13499400' ] +export const validOnlyByFormat = [ + 'RO1000000', + 'RO1000001', + 'RO1000002', + 'RO1000003' +] + export const invalid = [ 'RO11198698', 'RO99907', diff --git a/test/countries_vat_lists/russia.vat.js b/test/countries_vat_lists/russia.vat.js index 3b248e1..199bebd 100644 --- a/test/countries_vat_lists/russia.vat.js +++ b/test/countries_vat_lists/russia.vat.js @@ -35,6 +35,13 @@ export const valid = [ 'RU9909310782' ] +export const validOnlyByFormat = [ + 'RU7700000001', + 'RU7700000002', + 'RU7700000003', + 'RU7700000004' +] + export const invalid = [ 'RU5027187067', 'RU524911659', diff --git a/test/countries_vat_lists/serbia.vat.js b/test/countries_vat_lists/serbia.vat.js index bdbb873..75ba428 100644 --- a/test/countries_vat_lists/serbia.vat.js +++ b/test/countries_vat_lists/serbia.vat.js @@ -26,6 +26,13 @@ export const valid = [ 'RS129391320' ] +export const validOnlyByFormat = [ + 'RS100000000', + 'RS100000001', + 'RS100000002', + 'RS100000003' +] + export const invalid = [ 'RS12939132', 'RS1293913201', diff --git a/test/countries_vat_lists/slovakiaRepublic.vat.js b/test/countries_vat_lists/slovakiaRepublic.vat.js index 7521a0c..fff652b 100644 --- a/test/countries_vat_lists/slovakiaRepublic.vat.js +++ b/test/countries_vat_lists/slovakiaRepublic.vat.js @@ -50,6 +50,13 @@ export const valid = [ 'SK7020000680' ] +export const validOnlyByFormat = [ + 'SK7020000681', + 'SK7020000682', + 'SK7020000683', + 'SK7020000684' +] + export const invalid = [ 'SK5407062531', 'SK7020001680' diff --git a/test/countries_vat_lists/slovenia.vat.js b/test/countries_vat_lists/slovenia.vat.js index 953b137..bc2bf7a 100644 --- a/test/countries_vat_lists/slovenia.vat.js +++ b/test/countries_vat_lists/slovenia.vat.js @@ -48,6 +48,13 @@ export const valid = [ 'SI98511734' ] +export const validOnlyByFormat = [ + 'SI90000000', + 'SI90000001', + 'SI90000002', + 'SI90000003' +] + export const invalid = [ 'SI05936241' ] diff --git a/test/countries_vat_lists/spain.vat.js b/test/countries_vat_lists/spain.vat.js index 2c0e315..7e971ad 100644 --- a/test/countries_vat_lists/spain.vat.js +++ b/test/countries_vat_lists/spain.vat.js @@ -69,6 +69,13 @@ export const valid = [ 'ESA81626905' ] +export const validOnlyByFormat = [ + 'ESA0000002A', + 'ESA0000003A', + 'ESA0000004A', + 'ESA0000005A' +] + export const invalid = [ 'ESA0011012A', 'ES00000001A', diff --git a/test/countries_vat_lists/sweden.vat.js b/test/countries_vat_lists/sweden.vat.js index 7c10303..e4e6e53 100644 --- a/test/countries_vat_lists/sweden.vat.js +++ b/test/countries_vat_lists/sweden.vat.js @@ -49,6 +49,13 @@ export const valid = [ 'SE556785615701' ] +export const validOnlyByFormat = [ + 'SE000000002301', + 'SE000000022301', + 'SE000000052301', + 'SE000000042301' +] + export const invalid = [ 'SE556188840301', 'SE000000002301', diff --git a/test/countries_vat_lists/switzerland.vat.js b/test/countries_vat_lists/switzerland.vat.js index 1756222..ca7286a 100644 --- a/test/countries_vat_lists/switzerland.vat.js +++ b/test/countries_vat_lists/switzerland.vat.js @@ -75,6 +75,13 @@ export const valid = [ 'CHE-432.825.998 IVA', ] +export const validOnlyByFormat = [ + 'CHE000000001MWST', + 'CHE000000002MWST', + 'CHE000000003MWST', + 'CHE000000004MWST' +] + export const invalid = [ 'CHE-432.825.99-MWST', 'CHE-432.825.9980-MWST', diff --git a/test/countries_vat_lists/unitedKingdom.vat.js b/test/countries_vat_lists/unitedKingdom.vat.js index bd750a9..d1328d6 100644 --- a/test/countries_vat_lists/unitedKingdom.vat.js +++ b/test/countries_vat_lists/unitedKingdom.vat.js @@ -64,6 +64,13 @@ export const valid = [ 'GBGD103' ] +export const validOnlyByFormat = [ + 'GB000000000', + 'GB000000001', + 'GB000000002', + 'GB000000003' +] + export const invalid = [ 'GB999000103', 'GB999000201', diff --git a/test/croatia.spec.js b/test/croatia.spec.js index 9416c47..eacdcf3 100644 --- a/test/croatia.spec.js +++ b/test/croatia.spec.js @@ -1,27 +1,31 @@ import { croatia } from '../index' -import { codes, invalid, name, valid } from './countries_vat_lists/croatia.vat' -import { addCharsToString, checkInValidVat, checkValidVat } from './utils' +import { codes, invalid, name, valid, validOnlyByFormat } from './countries_vat_lists/croatia.vat' +import { addCharsToString, checkInvalidVat, checkOnlyValidFormatVat, checkValidVat } from './utils' describe('Croatia', () => { - it('should return true result for valid VATs', () => { + it('should return "true" result for valid VATs', () => { valid.forEach(vat => checkValidVat(vat, [croatia], codes, name)) }) + + it('should return "true" for "isSupportedCountry" and "isValidFormat" fields, but "false" for "isValid" for VATs that match format but still invalid', () => { + validOnlyByFormat.forEach(vat => checkOnlyValidFormatVat(vat, [croatia], codes, name)) + }) - it('should return true result for valid VATs with extra dash characters', () => { + it('should return "true" result for valid VATs with extra dash characters', () => { valid .map(vat => addCharsToString(vat, '-')) .forEach(vat => checkValidVat(vat, [croatia], codes, name)) }) - it('should return true result for valid VATs with extra space characters', () => { + it('should return "true" result for valid VATs with extra space characters', () => { valid .map(vat => addCharsToString(vat, ' ')) .forEach(vat => checkValidVat(vat, [croatia], codes, name)) }) - it('should return false result for invalid VATs', () => { - invalid.forEach(vat => checkInValidVat(vat, [croatia])) + it('should return "false" result for invalid VATs', () => { + invalid.forEach(vat => checkInvalidVat(vat, [croatia])) }) }) diff --git a/test/cyprus.spec.js b/test/cyprus.spec.js index f6f7738..282f8f1 100644 --- a/test/cyprus.spec.js +++ b/test/cyprus.spec.js @@ -1,27 +1,31 @@ import { cyprus } from '../index' -import { codes, invalid, name, valid } from './countries_vat_lists/cyprus.vat' -import { addCharsToString, checkInValidVat, checkValidVat } from './utils' +import { codes, invalid, name, valid, validOnlyByFormat } from './countries_vat_lists/cyprus.vat' +import { addCharsToString, checkInvalidVat, checkOnlyValidFormatVat, checkValidVat } from './utils' describe('Cyprus', () => { - it('should return true result for valid VATs', () => { + it('should return "true" result for valid VATs', () => { valid.forEach(vat => checkValidVat(vat, [cyprus], codes, name)) }) - it('should return true result for valid VATs with extra dash characters', () => { + it('should return "true" for "isSupportedCountry" and "isValidFormat" fields, but "false" for "isValid" for VATs that match format but still invalid', () => { + validOnlyByFormat.forEach(vat => checkOnlyValidFormatVat(vat, [cyprus], codes, name)) + }) + + it('should return "true" result for valid VATs with extra dash characters', () => { valid .map(vat => addCharsToString(vat, '-')) .forEach(vat => checkValidVat(vat, [cyprus], codes, name)) }) - it('should return true result for valid VATs with extra space characters', () => { + it('should return "true" result for valid VATs with extra space characters', () => { valid .map(vat => addCharsToString(vat, ' ')) .forEach(vat => checkValidVat(vat, [cyprus], codes, name)) }) - it('should return false result for invalid VATs', () => { - invalid.forEach(vat => checkInValidVat(vat, [cyprus])) + it('should return "false" result for invalid VATs', () => { + invalid.forEach(vat => checkInvalidVat(vat, [cyprus])) }) }) diff --git a/test/czechRepublic.spec.js b/test/czechRepublic.spec.js index 554ace4..13217ec 100644 --- a/test/czechRepublic.spec.js +++ b/test/czechRepublic.spec.js @@ -1,27 +1,31 @@ import { czechRepublic } from '../index' -import { codes, invalid, name, valid } from './countries_vat_lists/czechRepublic.vat' -import { addCharsToString, checkInValidVat, checkValidVat } from './utils' +import { codes, invalid, name, valid, validOnlyByFormat } from './countries_vat_lists/czechRepublic.vat' +import { addCharsToString, checkInvalidVat, checkOnlyValidFormatVat, checkValidVat } from './utils' describe('Czech Republic', () => { - it('should return true result for valid VATs', () => { + it('should return "true" result for valid VATs', () => { valid.forEach(vat => checkValidVat(vat, [czechRepublic], codes, name)) }) - it('should return true result for valid VATs with extra dash characters', () => { + it('should return "true" for "isSupportedCountry" and "isValidFormat" fields, but "false" for "isValid" for VATs that match format but still invalid', () => { + validOnlyByFormat.forEach(vat => checkOnlyValidFormatVat(vat, [czechRepublic], codes, name)) + }) + + it('should return "true" result for valid VATs with extra dash characters', () => { valid .map(vat => addCharsToString(vat, '-')) .forEach(vat => checkValidVat(vat, [czechRepublic], codes, name)) }) - it('should return true result for valid VATs with extra space characters', () => { + it('should return "true" result for valid VATs with extra space characters', () => { valid .map(vat => addCharsToString(vat, ' ')) .forEach(vat => checkValidVat(vat, [czechRepublic], codes, name)) }) - it('should return false result for invalid VATs', () => { - invalid.forEach(vat => checkInValidVat(vat, [czechRepublic])) + it('should return "false" result for invalid VATs', () => { + invalid.forEach(vat => checkInvalidVat(vat, [czechRepublic])) }) }) diff --git a/test/denmark.spec.js b/test/denmark.spec.js index 6704d12..4758bf0 100644 --- a/test/denmark.spec.js +++ b/test/denmark.spec.js @@ -1,27 +1,31 @@ import { denmark } from '../index' -import { codes, invalid, name, valid } from './countries_vat_lists/denmark.vat' -import { addCharsToString, checkInValidVat, checkValidVat } from './utils' +import { codes, invalid, name, valid, validOnlyByFormat } from './countries_vat_lists/denmark.vat' +import { addCharsToString, checkInvalidVat, checkOnlyValidFormatVat, checkValidVat } from './utils' describe('Denmark', () => { - it('should return true result for valid VATs', () => { + it('should return "true" result for valid VATs', () => { valid.forEach(vat => checkValidVat(vat, [denmark], codes, name)) }) - it('should return true result for valid VATs with extra dash characters', () => { + it('should return "true" for "isSupportedCountry" and "isValidFormat" fields, but "false" for "isValid" for VATs that match format but still invalid', () => { + validOnlyByFormat.forEach(vat => checkOnlyValidFormatVat(vat, [denmark], codes, name)) + }) + + it('should return "true" result for valid VATs with extra dash characters', () => { valid .map(vat => addCharsToString(vat, '-')) .forEach(vat => checkValidVat(vat, [denmark], codes, name)) }) - it('should return true result for valid VATs with extra space characters', () => { + it('should return "true" result for valid VATs with extra space characters', () => { valid .map(vat => addCharsToString(vat, ' ')) .forEach(vat => checkValidVat(vat, [denmark], codes, name)) }) - it('should return false result for invalid VATs', () => { - invalid.forEach(vat => checkInValidVat(vat, [denmark])) + it('should return "false" result for invalid VATs', () => { + invalid.forEach(vat => checkInvalidVat(vat, [denmark])) }) }) diff --git a/test/estonia.spec.js b/test/estonia.spec.js index 4e0057c..00f0487 100644 --- a/test/estonia.spec.js +++ b/test/estonia.spec.js @@ -1,27 +1,31 @@ import { estonia } from '../index' -import { codes, invalid, name, valid } from './countries_vat_lists/estonia.vat' -import { addCharsToString, checkInValidVat, checkValidVat } from './utils' +import { codes, invalid, name, valid, validOnlyByFormat } from './countries_vat_lists/estonia.vat' +import { addCharsToString, checkInvalidVat, checkOnlyValidFormatVat, checkValidVat } from './utils' describe('Estonia', () => { - it('should return true result for valid VATs', () => { + it('should return "true" result for valid VATs', () => { valid.forEach(vat => checkValidVat(vat, [estonia], codes, name)) }) - it('should return true result for valid VATs with extra dash characters', () => { + it('should return "true" for "isSupportedCountry" and "isValidFormat" fields, but "false" for "isValid" for VATs that match format but still invalid', () => { + validOnlyByFormat.forEach(vat => checkOnlyValidFormatVat(vat, [estonia], codes, name)) + }) + + it('should return "true" result for valid VATs with extra dash characters', () => { valid .map(vat => addCharsToString(vat, '-')) .forEach(vat => checkValidVat(vat, [estonia], codes, name)) }) - it('should return true result for valid VATs with extra space characters', () => { + it('should return "true" result for valid VATs with extra space characters', () => { valid .map(vat => addCharsToString(vat, ' ')) .forEach(vat => checkValidVat(vat, [estonia], codes, name)) }) - it('should return false result for invalid VATs', () => { - invalid.forEach(vat => checkInValidVat(vat, [estonia])) + it('should return "false" result for invalid VATs', () => { + invalid.forEach(vat => checkInvalidVat(vat, [estonia])) }) }) diff --git a/test/europe.spec.js b/test/europe.spec.js index 200de0d..56ee38a 100644 --- a/test/europe.spec.js +++ b/test/europe.spec.js @@ -1,27 +1,32 @@ import { europe } from '../index' -import { codes, invalid, name, valid } from './countries_vat_lists/europe.vat' -import { addCharsToString, checkInValidVat, checkValidVat } from './utils' +import { codes, invalid, name, valid, validOnlyByFormat } from './countries_vat_lists/europe.vat' +import { addCharsToString, checkInvalidVat, checkOnlyValidFormatVat, checkValidVat } from './utils' describe('Europe', () => { - it('should return true result for valid VATs', () => { + it('should return "true" result for valid VATs', () => { valid.forEach(vat => checkValidVat(vat, [europe], codes, name)) }) - it('should return true result for valid VATs with extra dash characters', () => { + // we can't check this for EU vat's cause isValid always true if regxp is true + // it('should return "true" for "isSupportedCountry" and "isValidFormat" fields, but "false" for "isValid" for VATs that match format but still invalid', () => { + // validOnlyByFormat.forEach(vat => checkOnlyValidFormatVat(vat, [europe], codes, name)) + // }) + + it('should return "true" result for valid VATs with extra dash characters', () => { valid .map(vat => addCharsToString(vat, '-')) .forEach(vat => checkValidVat(vat, [europe], codes, name)) }) - it('should return true result for valid VATs with extra space characters', () => { + it('should return "true" result for valid VATs with extra space characters', () => { valid .map(vat => addCharsToString(vat, ' ')) .forEach(vat => checkValidVat(vat, [europe], codes, name)) }) - it('should return false result for invalid VATs', () => { - invalid.forEach(vat => checkInValidVat(vat, [europe])) + it('should return "false" result for invalid VATs', () => { + invalid.forEach(vat => checkInvalidVat(vat, [europe])) }) }) diff --git a/test/finland.spec.js b/test/finland.spec.js index 5f4cf43..098afe8 100644 --- a/test/finland.spec.js +++ b/test/finland.spec.js @@ -1,27 +1,31 @@ import { finland } from '../index' -import { codes, invalid, name, valid } from './countries_vat_lists/finland.vat' -import { addCharsToString, checkInValidVat, checkValidVat } from './utils' +import { codes, invalid, name, valid, validOnlyByFormat } from './countries_vat_lists/finland.vat' +import { addCharsToString, checkInvalidVat, checkOnlyValidFormatVat, checkValidVat } from './utils' describe('Finland', () => { - it('should return true result for valid VATs', () => { + it('should return "true" result for valid VATs', () => { valid.forEach(vat => checkValidVat(vat, [finland], codes, name)) }) - it('should return true result for valid VATs with extra dash characters', () => { + it('should return "true" for "isSupportedCountry" and "isValidFormat" fields, but "false" for "isValid" for VATs that match format but still invalid', () => { + validOnlyByFormat.forEach(vat => checkOnlyValidFormatVat(vat, [finland], codes, name)) + }) + + it('should return "true" result for valid VATs with extra dash characters', () => { valid .map(vat => addCharsToString(vat, '-')) .forEach(vat => checkValidVat(vat, [finland], codes, name)) }) - it('should return true result for valid VATs with extra space characters', () => { + it('should return "true" result for valid VATs with extra space characters', () => { valid .map(vat => addCharsToString(vat, ' ')) .forEach(vat => checkValidVat(vat, [finland], codes, name)) }) - it('should return false result for invalid VATs', () => { - invalid.forEach(vat => checkInValidVat(vat, [finland])) + it('should return "false" result for invalid VATs', () => { + invalid.forEach(vat => checkInvalidVat(vat, [finland])) }) }) diff --git a/test/france.spec.js b/test/france.spec.js index f9631eb..65e717d 100644 --- a/test/france.spec.js +++ b/test/france.spec.js @@ -1,27 +1,31 @@ import { france } from '../index' -import { codes, invalid, name, valid } from './countries_vat_lists/france.vat' -import { addCharsToString, checkInValidVat, checkValidVat } from './utils' +import { codes, invalid, name, valid, validOnlyByFormat } from './countries_vat_lists/france.vat' +import { addCharsToString, checkInvalidVat, checkOnlyValidFormatVat, checkValidVat } from './utils' describe('France', () => { - it('should return true result for valid VATs', () => { + it('should return "true" result for valid VATs', () => { valid.forEach(vat => checkValidVat(vat, [france], codes, name)) }) - it('should return true result for valid VATs with extra dash characters', () => { + it('should return "true" for "isSupportedCountry" and "isValidFormat" fields, but "false" for "isValid" for VATs that match format but still invalid', () => { + validOnlyByFormat.forEach(vat => checkOnlyValidFormatVat(vat, [france], codes, name)) + }) + + it('should return "true" result for valid VATs with extra dash characters', () => { valid .map(vat => addCharsToString(vat, '-')) .forEach(vat => checkValidVat(vat, [france], codes, name)) }) - it('should return true result for valid VATs with extra space characters', () => { + it('should return "true" result for valid VATs with extra space characters', () => { valid .map(vat => addCharsToString(vat, ' ')) .forEach(vat => checkValidVat(vat, [france], codes, name)) }) - it('should return false result for invalid VATs', () => { - invalid.forEach(vat => checkInValidVat(vat, [france])) + it('should return "false" result for invalid VATs', () => { + invalid.forEach(vat => checkInvalidVat(vat, [france])) }) }) diff --git a/test/germany.spec.js b/test/germany.spec.js index 427e72c..ce5d957 100644 --- a/test/germany.spec.js +++ b/test/germany.spec.js @@ -1,27 +1,31 @@ import { germany } from '../index' -import { codes, invalid, name, valid } from './countries_vat_lists/germany.vat' -import { addCharsToString, checkInValidVat, checkValidVat } from './utils' +import { codes, invalid, name, valid, validOnlyByFormat } from './countries_vat_lists/germany.vat' +import { addCharsToString, checkInvalidVat, checkOnlyValidFormatVat, checkValidVat } from './utils' describe('Germany', () => { - it('should return true result for valid VATs', () => { + it('should return "true" result for valid VATs', () => { valid.forEach(vat => checkValidVat(vat, [germany], codes, name)) }) - it('should return true result for valid VATs with extra dash characters', () => { + it('should return "true" for "isSupportedCountry" and "isValidFormat" fields, but "false" for "isValid" for VATs that match format but still invalid', () => { + validOnlyByFormat.forEach(vat => checkOnlyValidFormatVat(vat, [germany], codes, name)) + }) + + it('should return "true" result for valid VATs with extra dash characters', () => { valid .map(vat => addCharsToString(vat, '-')) .forEach(vat => checkValidVat(vat, [germany], codes, name)) }) - it('should return true result for valid VATs with extra space characters', () => { + it('should return "true" result for valid VATs with extra space characters', () => { valid .map(vat => addCharsToString(vat, ' ')) .forEach(vat => checkValidVat(vat, [germany], codes, name)) }) - it('should return false result for invalid VATs', () => { - invalid.forEach(vat => checkInValidVat(vat, [germany])) + it('should return "false" result for invalid VATs', () => { + invalid.forEach(vat => checkInvalidVat(vat, [germany])) }) }) diff --git a/test/greece.spec.js b/test/greece.spec.js index d666cce..e181271 100644 --- a/test/greece.spec.js +++ b/test/greece.spec.js @@ -1,27 +1,31 @@ import { greece } from '../index' -import { codes, invalid, name, valid } from './countries_vat_lists/greece.vat' -import { addCharsToString, checkInValidVat, checkValidVat } from './utils' +import { codes, invalid, name, valid, validOnlyByFormat } from './countries_vat_lists/greece.vat' +import { addCharsToString, checkInvalidVat, checkOnlyValidFormatVat, checkValidVat } from './utils' describe('Greece', () => { - it('should return true result for valid VATs', () => { + it('should return "true" result for valid VATs', () => { valid.forEach(vat => checkValidVat(vat, [greece], codes, name)) }) - it('should return true result for valid VATs with extra dash characters', () => { + it('should return "true" for "isSupportedCountry" and "isValidFormat" fields, but "false" for "isValid" for VATs that match format but still invalid', () => { + validOnlyByFormat.forEach(vat => checkOnlyValidFormatVat(vat, [greece], codes, name)) + }) + + it('should return "true" result for valid VATs with extra dash characters', () => { valid .map(vat => addCharsToString(vat, '-')) .forEach(vat => checkValidVat(vat, [greece], codes, name)) }) - it('should return true result for valid VATs with extra space characters', () => { + it('should return "true" result for valid VATs with extra space characters', () => { valid .map(vat => addCharsToString(vat, ' ')) .forEach(vat => checkValidVat(vat, [greece], codes, name)) }) - it('should return false result for invalid VATs', () => { - invalid.forEach(vat => checkInValidVat(vat, [greece])) + it('should return "false" result for invalid VATs', () => { + invalid.forEach(vat => checkInvalidVat(vat, [greece])) }) }) diff --git a/test/hungary.spec.js b/test/hungary.spec.js index 169badf..ab4ba8f 100644 --- a/test/hungary.spec.js +++ b/test/hungary.spec.js @@ -1,27 +1,31 @@ import { hungary } from '../index' -import { codes, invalid, name, valid } from './countries_vat_lists/hungary.vat' -import { addCharsToString, checkInValidVat, checkValidVat } from './utils' +import { codes, invalid, name, valid, validOnlyByFormat } from './countries_vat_lists/hungary.vat' +import { addCharsToString, checkInvalidVat, checkOnlyValidFormatVat, checkValidVat } from './utils' describe('Hungary', () => { - it('should return true result for valid VATs', () => { + it('should return "true" result for valid VATs', () => { valid.forEach(vat => checkValidVat(vat, [hungary], codes, name)) }) - it('should return true result for valid VATs with extra dash characters', () => { + it('should return "true" for "isSupportedCountry" and "isValidFormat" fields, but "false" for "isValid" for VATs that match format but still invalid', () => { + validOnlyByFormat.forEach(vat => checkOnlyValidFormatVat(vat, [hungary], codes, name)) + }) + + it('should return "true" result for valid VATs with extra dash characters', () => { valid .map(vat => addCharsToString(vat, '-')) .forEach(vat => checkValidVat(vat, [hungary], codes, name)) }) - it('should return true result for valid VATs with extra space characters', () => { + it('should return "true" result for valid VATs with extra space characters', () => { valid .map(vat => addCharsToString(vat, ' ')) .forEach(vat => checkValidVat(vat, [hungary], codes, name)) }) - it('should return false result for invalid VATs', () => { - invalid.forEach(vat => checkInValidVat(vat, [hungary])) + it('should return "false" result for invalid VATs', () => { + invalid.forEach(vat => checkInvalidVat(vat, [hungary])) }) }) diff --git a/test/ireland.spec.js b/test/ireland.spec.js index bd9893b..e126648 100644 --- a/test/ireland.spec.js +++ b/test/ireland.spec.js @@ -1,27 +1,31 @@ import { ireland } from '../index' -import { codes, invalid, name, valid } from './countries_vat_lists/ireland.vat' -import { addCharsToString, checkInValidVat, checkValidVat } from './utils' +import { codes, invalid, name, valid, validOnlyByFormat } from './countries_vat_lists/ireland.vat' +import { addCharsToString, checkInvalidVat, checkOnlyValidFormatVat, checkValidVat } from './utils' describe('Ireland', () => { - it('should return true result for valid VATs', () => { + it('should return "true" result for valid VATs', () => { valid.forEach(vat => checkValidVat(vat, [ireland], codes, name)) }) - it('should return true result for valid VATs with extra dash characters', () => { + it('should return "true" for "isSupportedCountry" and "isValidFormat" fields, but "false" for "isValid" for VATs that match format but still invalid', () => { + validOnlyByFormat.forEach(vat => checkOnlyValidFormatVat(vat, [ireland], codes, name)) + }) + + it('should return "true" result for valid VATs with extra dash characters', () => { valid .map(vat => addCharsToString(vat, '-')) .forEach(vat => checkValidVat(vat, [ireland], codes, name)) }) - it('should return true result for valid VATs with extra space characters', () => { + it('should return "true" result for valid VATs with extra space characters', () => { valid .map(vat => addCharsToString(vat, ' ')) .forEach(vat => checkValidVat(vat, [ireland], codes, name)) }) - it('should return false result for invalid VATs', () => { - invalid.forEach(vat => checkInValidVat(vat, [ireland])) + it('should return "false" result for invalid VATs', () => { + invalid.forEach(vat => checkInvalidVat(vat, [ireland])) }) }) diff --git a/test/italy.spec.js b/test/italy.spec.js index 8a76ce2..963733e 100644 --- a/test/italy.spec.js +++ b/test/italy.spec.js @@ -1,27 +1,31 @@ import { italy } from '../index' -import { codes, invalid, name, valid } from './countries_vat_lists/italy.vat' -import { addCharsToString, checkInValidVat, checkValidVat } from './utils' +import { codes, invalid, name, valid, validOnlyByFormat } from './countries_vat_lists/italy.vat' +import { addCharsToString, checkInvalidVat, checkOnlyValidFormatVat, checkValidVat } from './utils' describe('Italy', () => { - it('should return true result for valid VATs', () => { + it('should return "true" result for valid VATs', () => { valid.forEach(vat => checkValidVat(vat, [italy], codes, name)) }) - it('should return true result for valid VATs with extra dash characters', () => { + it('should return "true" for "isSupportedCountry" and "isValidFormat" fields, but "false" for "isValid" for VATs that match format but still invalid', () => { + validOnlyByFormat.forEach(vat => checkOnlyValidFormatVat(vat, [italy], codes, name)) + }) + + it('should return "true" result for valid VATs with extra dash characters', () => { valid .map(vat => addCharsToString(vat, '-')) .forEach(vat => checkValidVat(vat, [italy], codes, name)) }) - it('should return true result for valid VATs with extra space characters', () => { + it('should return "true" result for valid VATs with extra space characters', () => { valid .map(vat => addCharsToString(vat, ' ')) .forEach(vat => checkValidVat(vat, [italy], codes, name)) }) - it('should return false result for invalid VATs', () => { - invalid.forEach(vat => checkInValidVat(vat, [italy])) + it('should return "false" result for invalid VATs', () => { + invalid.forEach(vat => checkInvalidVat(vat, [italy])) }) }) diff --git a/test/latvia.spec.js b/test/latvia.spec.js index bfbb4ef..65d3ebf 100644 --- a/test/latvia.spec.js +++ b/test/latvia.spec.js @@ -1,27 +1,31 @@ import { latvia } from '../index' -import { codes, invalid, name, valid } from './countries_vat_lists/latvia.vat' -import { addCharsToString, checkInValidVat, checkValidVat } from './utils' +import { codes, invalid, name, valid, validOnlyByFormat } from './countries_vat_lists/latvia.vat' +import { addCharsToString, checkInvalidVat, checkOnlyValidFormatVat, checkValidVat } from './utils' describe('Latvia', () => { - it('should return true result for valid VATs', () => { + it('should return "true" result for valid VATs', () => { valid.forEach(vat => checkValidVat(vat, [latvia], codes, name)) }) - it('should return true result for valid VATs with extra dash characters', () => { + it('should return "true" for "isSupportedCountry" and "isValidFormat" fields, but "false" for "isValid" for VATs that match format but still invalid', () => { + validOnlyByFormat.forEach(vat => checkOnlyValidFormatVat(vat, [latvia], codes, name)) + }) + + it('should return "true" result for valid VATs with extra dash characters', () => { valid .map(vat => addCharsToString(vat, '-')) .forEach(vat => checkValidVat(vat, [latvia], codes, name)) }) - it('should return true result for valid VATs with extra space characters', () => { + it('should return "true" result for valid VATs with extra space characters', () => { valid .map(vat => addCharsToString(vat, ' ')) .forEach(vat => checkValidVat(vat, [latvia], codes, name)) }) - it('should return false result for invalid VATs', () => { - invalid.forEach(vat => checkInValidVat(vat, [latvia])) + it('should return "false" result for invalid VATs', () => { + invalid.forEach(vat => checkInvalidVat(vat, [latvia])) }) }) diff --git a/test/lithuania.spec.js b/test/lithuania.spec.js index 492536c..043f4a4 100644 --- a/test/lithuania.spec.js +++ b/test/lithuania.spec.js @@ -1,27 +1,31 @@ import { lithuania } from '../index' -import { codes, invalid, name, valid } from './countries_vat_lists/lithuania.vat' -import { addCharsToString, checkInValidVat, checkValidVat } from './utils' +import { codes, invalid, name, valid, validOnlyByFormat } from './countries_vat_lists/lithuania.vat' +import { addCharsToString, checkInvalidVat, checkOnlyValidFormatVat, checkValidVat } from './utils' describe('Lithuania', () => { - it('should return true result for valid VATs', () => { + it('should return "true" result for valid VATs', () => { valid.forEach(vat => checkValidVat(vat, [lithuania], codes, name)) }) - it('should return true result for valid VATs with extra dash characters', () => { + it('should return "true" for "isSupportedCountry" and "isValidFormat" fields, but "false" for "isValid" for VATs that match format but still invalid', () => { + validOnlyByFormat.forEach(vat => checkOnlyValidFormatVat(vat, [lithuania], codes, name)) + }) + + it('should return "true" result for valid VATs with extra dash characters', () => { valid .map(vat => addCharsToString(vat, '-')) .forEach(vat => checkValidVat(vat, [lithuania], codes, name)) }) - it('should return true result for valid VATs with extra space characters', () => { + it('should return "true" result for valid VATs with extra space characters', () => { valid .map(vat => addCharsToString(vat, ' ')) .forEach(vat => checkValidVat(vat, [lithuania], codes, name)) }) - it('should return false result for invalid VATs', () => { - invalid.forEach(vat => checkInValidVat(vat, [lithuania])) + it('should return "false" result for invalid VATs', () => { + invalid.forEach(vat => checkInvalidVat(vat, [lithuania])) }) }) diff --git a/test/luxembourg.spec.js b/test/luxembourg.spec.js index 8e185fa..8c3911e 100644 --- a/test/luxembourg.spec.js +++ b/test/luxembourg.spec.js @@ -1,27 +1,31 @@ import { luxembourg } from '../index' -import { codes, invalid, name, valid } from './countries_vat_lists/luxembourg.vat' -import { addCharsToString, checkInValidVat, checkValidVat } from './utils' +import { codes, invalid, name, valid, validOnlyByFormat } from './countries_vat_lists/luxembourg.vat' +import { addCharsToString, checkInvalidVat, checkOnlyValidFormatVat, checkValidVat } from './utils' describe('Luxembourg', () => { - it('should return true result for valid VATs', () => { + it('should return "true" result for valid VATs', () => { valid.forEach(vat => checkValidVat(vat, [luxembourg], codes, name)) }) - it('should return true result for valid VATs with extra dash characters', () => { + it('should return "true" for "isSupportedCountry" and "isValidFormat" fields, but "false" for "isValid" for VATs that match format but still invalid', () => { + validOnlyByFormat.forEach(vat => checkOnlyValidFormatVat(vat, [luxembourg], codes, name)) + }) + + it('should return "true" result for valid VATs with extra dash characters', () => { valid .map(vat => addCharsToString(vat, '-')) .forEach(vat => checkValidVat(vat, [luxembourg], codes, name)) }) - it('should return true result for valid VATs with extra space characters', () => { + it('should return "true" result for valid VATs with extra space characters', () => { valid .map(vat => addCharsToString(vat, ' ')) .forEach(vat => checkValidVat(vat, [luxembourg], codes, name)) }) - it('should return false result for invalid VATs', () => { - invalid.forEach(vat => checkInValidVat(vat, [luxembourg])) + it('should return "false" result for invalid VATs', () => { + invalid.forEach(vat => checkInvalidVat(vat, [luxembourg])) }) }) diff --git a/test/malta.spec.js b/test/malta.spec.js index a2c7956..48361ee 100644 --- a/test/malta.spec.js +++ b/test/malta.spec.js @@ -1,27 +1,31 @@ import { malta } from '../index' -import { codes, invalid, name, valid } from './countries_vat_lists/malta.vat' -import { addCharsToString, checkInValidVat, checkValidVat } from './utils' +import { codes, invalid, name, valid, validOnlyByFormat } from './countries_vat_lists/malta.vat' +import { addCharsToString, checkInvalidVat, checkOnlyValidFormatVat, checkValidVat } from './utils' describe('Malta', () => { - it('should return true result for valid VATs', () => { + it('should return "true" result for valid VATs', () => { valid.forEach(vat => checkValidVat(vat, [malta], codes, name)) }) - it('should return true result for valid VATs with extra dash characters', () => { + it('should return "true" for "isSupportedCountry" and "isValidFormat" fields, but "false" for "isValid" for VATs that match format but still invalid', () => { + validOnlyByFormat.forEach(vat => checkOnlyValidFormatVat(vat, [malta], codes, name)) + }) + + it('should return "true" result for valid VATs with extra dash characters', () => { valid .map(vat => addCharsToString(vat, '-')) .forEach(vat => checkValidVat(vat, [malta], codes, name)) }) - it('should return true result for valid VATs with extra space characters', () => { + it('should return "true" result for valid VATs with extra space characters', () => { valid .map(vat => addCharsToString(vat, ' ')) .forEach(vat => checkValidVat(vat, [malta], codes, name)) }) - it('should return false result for invalid VATs', () => { - invalid.forEach(vat => checkInValidVat(vat, [malta])) + it('should return "false" result for invalid VATs', () => { + invalid.forEach(vat => checkInvalidVat(vat, [malta])) }) }) diff --git a/test/netherlands.spec.js b/test/netherlands.spec.js index 9a3599d..2b2f1c9 100644 --- a/test/netherlands.spec.js +++ b/test/netherlands.spec.js @@ -1,27 +1,31 @@ import { netherlands } from '../index' -import { codes, invalid, name, valid } from './countries_vat_lists/netherlands.vat' -import { addCharsToString, checkInValidVat, checkValidVat } from './utils' +import { codes, invalid, name, valid, validOnlyByFormat } from './countries_vat_lists/netherlands.vat' +import { addCharsToString, checkInvalidVat, checkOnlyValidFormatVat, checkValidVat } from './utils' describe('Netherlands', () => { - it('should return true result for valid VATs', () => { + it('should return "true" result for valid VATs', () => { valid.forEach(vat => checkValidVat(vat, [netherlands], codes, name)) }) - it('should return true result for valid VATs with extra dash characters', () => { + it('should return "true" for "isSupportedCountry" and "isValidFormat" fields, but "false" for "isValid" for VATs that match format but still invalid', () => { + validOnlyByFormat.forEach(vat => checkOnlyValidFormatVat(vat, [netherlands], codes, name)) + }) + + it('should return "true" result for valid VATs with extra dash characters', () => { valid .map(vat => addCharsToString(vat, '-')) .forEach(vat => checkValidVat(vat, [netherlands], codes, name)) }) - it('should return true result for valid VATs with extra space characters', () => { + it('should return "true" result for valid VATs with extra space characters', () => { valid .map(vat => addCharsToString(vat, ' ')) .forEach(vat => checkValidVat(vat, [netherlands], codes, name)) }) - it('should return false result for invalid VATs', () => { - invalid.forEach(vat => checkInValidVat(vat, [netherlands])) + it('should return "false" result for invalid VATs', () => { + invalid.forEach(vat => checkInvalidVat(vat, [netherlands])) }) }) diff --git a/test/norway.spec.js b/test/norway.spec.js index ec1ed28..eb6982c 100644 --- a/test/norway.spec.js +++ b/test/norway.spec.js @@ -1,27 +1,31 @@ import { norway } from '../index' -import { codes, invalid, name, valid } from './countries_vat_lists/norway.vat' -import { addCharsToString, checkInValidVat, checkValidVat } from './utils' +import { codes, invalid, name, valid, validOnlyByFormat } from './countries_vat_lists/norway.vat' +import { addCharsToString, checkInvalidVat, checkOnlyValidFormatVat, checkValidVat } from './utils' describe('Norway', () => { - it('should return true result for valid VATs', () => { + it('should return "true" result for valid VATs', () => { valid.forEach(vat => checkValidVat(vat, [norway], codes, name)) }) - it('should return true result for valid VATs with extra dash characters', () => { + it('should return "true" for "isSupportedCountry" and "isValidFormat" fields, but "false" for "isValid" for VATs that match format but still invalid', () => { + validOnlyByFormat.forEach(vat => checkOnlyValidFormatVat(vat, [norway], codes, name)) + }) + + it('should return "true" result for valid VATs with extra dash characters', () => { valid .map(vat => addCharsToString(vat, '-')) .forEach(vat => checkValidVat(vat, [norway], codes, name)) }) - it('should return true result for valid VATs with extra space characters', () => { + it('should return "true" result for valid VATs with extra space characters', () => { valid .map(vat => addCharsToString(vat, ' ')) .forEach(vat => checkValidVat(vat, [norway], codes, name)) }) - it('should return false result for invalid VATs', () => { - invalid.forEach(vat => checkInValidVat(vat, [norway])) + it('should return "false" result for invalid VATs', () => { + invalid.forEach(vat => checkInvalidVat(vat, [norway])) }) }) diff --git a/test/poland.spec.js b/test/poland.spec.js index a0823b4..089f3c9 100644 --- a/test/poland.spec.js +++ b/test/poland.spec.js @@ -1,27 +1,31 @@ import { poland } from '../index' -import { codes, invalid, name, valid } from './countries_vat_lists/poland.vat' -import { addCharsToString, checkInValidVat, checkValidVat } from './utils' +import { codes, invalid, name, valid, validOnlyByFormat } from './countries_vat_lists/poland.vat' +import { addCharsToString, checkInvalidVat, checkOnlyValidFormatVat, checkValidVat } from './utils' describe('Poland', () => { - it('should return true result for valid VATs', () => { + it('should return "true" result for valid VATs', () => { valid.forEach(vat => checkValidVat(vat, [poland], codes, name)) }) - it('should return true result for valid VATs with extra dash characters', () => { + it('should return "true" for "isSupportedCountry" and "isValidFormat" fields, but "false" for "isValid" for VATs that match format but still invalid', () => { + validOnlyByFormat.forEach(vat => checkOnlyValidFormatVat(vat, [poland], codes, name)) + }) + + it('should return "true" result for valid VATs with extra dash characters', () => { valid .map(vat => addCharsToString(vat, '-')) .forEach(vat => checkValidVat(vat, [poland], codes, name)) }) - it('should return true result for valid VATs with extra space characters', () => { + it('should return "true" result for valid VATs with extra space characters', () => { valid .map(vat => addCharsToString(vat, ' ')) .forEach(vat => checkValidVat(vat, [poland], codes, name)) }) - it('should return false result for invalid VATs', () => { - invalid.forEach(vat => checkInValidVat(vat, [poland])) + it('should return "false" result for invalid VATs', () => { + invalid.forEach(vat => checkInvalidVat(vat, [poland])) }) }) diff --git a/test/portugal.spec.js b/test/portugal.spec.js index 34135e9..f912f11 100644 --- a/test/portugal.spec.js +++ b/test/portugal.spec.js @@ -1,27 +1,31 @@ import { portugal } from '../index' -import { codes, invalid, name, valid } from './countries_vat_lists/portugal.vat' -import { addCharsToString, checkInValidVat, checkValidVat } from './utils' +import { codes, invalid, name, valid, validOnlyByFormat } from './countries_vat_lists/portugal.vat' +import { addCharsToString, checkInvalidVat, checkOnlyValidFormatVat, checkValidVat } from './utils' describe('Portugal', () => { - it('should return true result for valid VATs', () => { + it('should return "true" result for valid VATs', () => { valid.forEach(vat => checkValidVat(vat, [portugal], codes, name)) }) - it('should return true result for valid VATs with extra dash characters', () => { + it('should return "true" for "isSupportedCountry" and "isValidFormat" fields, but "false" for "isValid" for VATs that match format but still invalid', () => { + validOnlyByFormat.forEach(vat => checkOnlyValidFormatVat(vat, [portugal], codes, name)) + }) + + it('should return "true" result for valid VATs with extra dash characters', () => { valid .map(vat => addCharsToString(vat, '-')) .forEach(vat => checkValidVat(vat, [portugal], codes, name)) }) - it('should return true result for valid VATs with extra space characters', () => { + it('should return "true" result for valid VATs with extra space characters', () => { valid .map(vat => addCharsToString(vat, ' ')) .forEach(vat => checkValidVat(vat, [portugal], codes, name)) }) - it('should return false result for invalid VATs', () => { - invalid.forEach(vat => checkInValidVat(vat, [portugal])) + it('should return "false" result for invalid VATs', () => { + invalid.forEach(vat => checkInvalidVat(vat, [portugal])) }) }) diff --git a/test/romania.spec.js b/test/romania.spec.js index b4039f7..971181c 100644 --- a/test/romania.spec.js +++ b/test/romania.spec.js @@ -1,27 +1,31 @@ import { romania } from '../index' -import { codes, invalid, name, valid } from './countries_vat_lists/romania.vat' -import { addCharsToString, checkInValidVat, checkValidVat } from './utils' +import { codes, invalid, name, valid, validOnlyByFormat } from './countries_vat_lists/romania.vat' +import { addCharsToString, checkInvalidVat, checkOnlyValidFormatVat, checkValidVat } from './utils' describe('Romania', () => { - it('should return true result for valid VATs', () => { + it('should return "true" result for valid VATs', () => { valid.forEach(vat => checkValidVat(vat, [romania], codes, name)) }) - it('should return true result for valid VATs with extra dash characters', () => { + it('should return "true" for "isSupportedCountry" and "isValidFormat" fields, but "false" for "isValid" for VATs that match format but still invalid', () => { + validOnlyByFormat.forEach(vat => checkOnlyValidFormatVat(vat, [romania], codes, name)) + }) + + it('should return "true" result for valid VATs with extra dash characters', () => { valid .map(vat => addCharsToString(vat, '-')) .forEach(vat => checkValidVat(vat, [romania], codes, name)) }) - it('should return true result for valid VATs with extra space characters', () => { + it('should return "true" result for valid VATs with extra space characters', () => { valid .map(vat => addCharsToString(vat, ' ')) .forEach(vat => checkValidVat(vat, [romania], codes, name)) }) - it('should return false result for invalid VATs', () => { - invalid.forEach(vat => checkInValidVat(vat, [romania])) + it('should return "false" result for invalid VATs', () => { + invalid.forEach(vat => checkInvalidVat(vat, [romania])) }) }) diff --git a/test/russia.spec.js b/test/russia.spec.js index 17ac063..0d47d56 100644 --- a/test/russia.spec.js +++ b/test/russia.spec.js @@ -1,27 +1,31 @@ import { russia } from '../index' -import { codes, invalid, name, valid } from './countries_vat_lists/russia.vat' -import { addCharsToString, checkInValidVat, checkValidVat } from './utils' +import { codes, invalid, name, valid, validOnlyByFormat } from './countries_vat_lists/russia.vat' +import { addCharsToString, checkInvalidVat, checkOnlyValidFormatVat, checkValidVat } from './utils' describe('Russia', () => { - it('should return true result for valid VATs', () => { + it('should return "true" result for valid VATs', () => { valid.forEach(vat => checkValidVat(vat, [russia], codes, name)) }) - it('should return true result for valid VATs with extra dash characters', () => { + it('should return "true" for "isSupportedCountry" and "isValidFormat" fields, but "false" for "isValid" for VATs that match format but still invalid', () => { + validOnlyByFormat.forEach(vat => checkOnlyValidFormatVat(vat, [russia], codes, name)) + }) + + it('should return "true" result for valid VATs with extra dash characters', () => { valid .map(vat => addCharsToString(vat, '-')) .forEach(vat => checkValidVat(vat, [russia], codes, name)) }) - it('should return true result for valid VATs with extra space characters', () => { + it('should return "true" result for valid VATs with extra space characters', () => { valid .map(vat => addCharsToString(vat, ' ')) .forEach(vat => checkValidVat(vat, [russia], codes, name)) }) - it('should return false result for invalid VATs', () => { - invalid.forEach(vat => checkInValidVat(vat, [russia])) + it('should return "false" result for invalid VATs', () => { + invalid.forEach(vat => checkInvalidVat(vat, [russia])) }) }) diff --git a/test/serbia.spec.js b/test/serbia.spec.js index eca5ec0..a39c900 100644 --- a/test/serbia.spec.js +++ b/test/serbia.spec.js @@ -1,27 +1,31 @@ import { serbia } from '../index' -import { codes, invalid, name, valid } from './countries_vat_lists/serbia.vat' -import { addCharsToString, checkInValidVat, checkValidVat } from './utils' +import { codes, invalid, name, valid, validOnlyByFormat } from './countries_vat_lists/serbia.vat' +import { addCharsToString, checkInvalidVat, checkOnlyValidFormatVat, checkValidVat } from './utils' describe('Serbia', () => { - it('should return true result for valid VATs', () => { + it('should return "true" result for valid VATs', () => { valid.forEach(vat => checkValidVat(vat, [serbia], codes, name)) }) - it('should return true result for valid VATs with extra dash characters', () => { + it('should return "true" for "isSupportedCountry" and "isValidFormat" fields, but "false" for "isValid" for VATs that match format but still invalid', () => { + validOnlyByFormat.forEach(vat => checkOnlyValidFormatVat(vat, [serbia], codes, name)) + }) + + it('should return "true" result for valid VATs with extra dash characters', () => { valid .map(vat => addCharsToString(vat, '-')) .forEach(vat => checkValidVat(vat, [serbia], codes, name)) }) - it('should return true result for valid VATs with extra space characters', () => { + it('should return "true" result for valid VATs with extra space characters', () => { valid .map(vat => addCharsToString(vat, ' ')) .forEach(vat => checkValidVat(vat, [serbia], codes, name)) }) - it('should return false result for invalid VATs', () => { - invalid.forEach(vat => checkInValidVat(vat, [serbia])) + it('should return "false" result for invalid VATs', () => { + invalid.forEach(vat => checkInvalidVat(vat, [serbia])) }) }) diff --git a/test/slovakiaRepublic.spec.js b/test/slovakiaRepublic.spec.js index 55d7e3e..61472cc 100644 --- a/test/slovakiaRepublic.spec.js +++ b/test/slovakiaRepublic.spec.js @@ -1,27 +1,31 @@ import { slovakiaRepublic } from '../index' -import { codes, invalid, name, valid } from './countries_vat_lists/slovakiaRepublic.vat' -import { addCharsToString, checkInValidVat, checkValidVat } from './utils' +import { codes, invalid, name, valid, validOnlyByFormat } from './countries_vat_lists/slovakiaRepublic.vat' +import { addCharsToString, checkInvalidVat, checkOnlyValidFormatVat, checkValidVat } from './utils' describe('Slovakia Republic', () => { - it('should return true result for valid VATs', () => { + it('should return "true" result for valid VATs', () => { valid.forEach(vat => checkValidVat(vat, [slovakiaRepublic], codes, name)) }) - it('should return true result for valid VATs with extra dash characters', () => { + it('should return "true" for "isSupportedCountry" and "isValidFormat" fields, but "false" for "isValid" for VATs that match format but still invalid', () => { + validOnlyByFormat.forEach(vat => checkOnlyValidFormatVat(vat, [slovakiaRepublic], codes, name)) + }) + + it('should return "true" result for valid VATs with extra dash characters', () => { valid .map(vat => addCharsToString(vat, '-')) .forEach(vat => checkValidVat(vat, [slovakiaRepublic], codes, name)) }) - it('should return true result for valid VATs with extra space characters', () => { + it('should return "true" result for valid VATs with extra space characters', () => { valid .map(vat => addCharsToString(vat, ' ')) .forEach(vat => checkValidVat(vat, [slovakiaRepublic], codes, name)) }) - it('should return false result for invalid VATs', () => { - invalid.forEach(vat => checkInValidVat(vat, [slovakiaRepublic])) + it('should return "false" result for invalid VATs', () => { + invalid.forEach(vat => checkInvalidVat(vat, [slovakiaRepublic])) }) }) diff --git a/test/slovenia.spec.js b/test/slovenia.spec.js index 95d3e68..707fad4 100644 --- a/test/slovenia.spec.js +++ b/test/slovenia.spec.js @@ -1,27 +1,31 @@ import { slovenia } from '../index' -import { codes, invalid, name, valid } from './countries_vat_lists/slovenia.vat' -import { addCharsToString, checkInValidVat, checkValidVat } from './utils' +import { codes, invalid, name, valid, validOnlyByFormat } from './countries_vat_lists/slovenia.vat' +import { addCharsToString, checkInvalidVat, checkOnlyValidFormatVat, checkValidVat } from './utils' describe('Slovenia', () => { - it('should return true result for valid VATs', () => { + it('should return "true" result for valid VATs', () => { valid.forEach(vat => checkValidVat(vat, [slovenia], codes, name)) }) - it('should return true result for valid VATs with extra dash characters', () => { + it('should return "true" for "isSupportedCountry" and "isValidFormat" fields, but "false" for "isValid" for VATs that match format but still invalid', () => { + validOnlyByFormat.forEach(vat => checkOnlyValidFormatVat(vat, [slovenia], codes, name)) + }) + + it('should return "true" result for valid VATs with extra dash characters', () => { valid .map(vat => addCharsToString(vat, '-')) .forEach(vat => checkValidVat(vat, [slovenia], codes, name)) }) - it('should return true result for valid VATs with extra space characters', () => { + it('should return "true" result for valid VATs with extra space characters', () => { valid .map(vat => addCharsToString(vat, ' ')) .forEach(vat => checkValidVat(vat, [slovenia], codes, name)) }) - it('should return false result for invalid VATs', () => { - invalid.forEach(vat => checkInValidVat(vat, [slovenia])) + it('should return "false" result for invalid VATs', () => { + invalid.forEach(vat => checkInvalidVat(vat, [slovenia])) }) }) diff --git a/test/spain.spec.js b/test/spain.spec.js index 8a6bc54..a91dd77 100644 --- a/test/spain.spec.js +++ b/test/spain.spec.js @@ -1,27 +1,31 @@ import { spain } from '../index' -import { codes, invalid, name, valid } from './countries_vat_lists/spain.vat' -import { addCharsToString, checkInValidVat, checkValidVat } from './utils' +import { codes, invalid, name, valid, validOnlyByFormat } from './countries_vat_lists/spain.vat' +import { addCharsToString, checkInvalidVat, checkOnlyValidFormatVat, checkValidVat } from './utils' describe('Spain', () => { - it('should return true result for valid VATs', () => { + it('should return "true" result for valid VATs', () => { valid.forEach(vat => checkValidVat(vat, [spain], codes, name)) }) - it('should return true result for valid VATs with extra dash characters', () => { + it('should return "true" for "isSupportedCountry" and "isValidFormat" fields, but "false" for "isValid" for VATs that match format but still invalid', () => { + validOnlyByFormat.forEach(vat => checkOnlyValidFormatVat(vat, [spain], codes, name)) + }) + + it('should return "true" result for valid VATs with extra dash characters', () => { valid .map(vat => addCharsToString(vat, '-')) .forEach(vat => checkValidVat(vat, [spain], codes, name)) }) - it('should return true result for valid VATs with extra space characters', () => { + it('should return "true" result for valid VATs with extra space characters', () => { valid .map(vat => addCharsToString(vat, ' ')) .forEach(vat => checkValidVat(vat, [spain], codes, name)) }) - it('should return false result for invalid VATs', () => { - invalid.forEach(vat => checkInValidVat(vat, [spain])) + it('should return "false" result for invalid VATs', () => { + invalid.forEach(vat => checkInvalidVat(vat, [spain])) }) }) diff --git a/test/sweden.spec.js b/test/sweden.spec.js index 60eb5be..3b5008c 100644 --- a/test/sweden.spec.js +++ b/test/sweden.spec.js @@ -1,27 +1,31 @@ import { sweden } from '../index' -import { codes, invalid, name, valid } from './countries_vat_lists/sweden.vat' -import { addCharsToString, checkInValidVat, checkValidVat } from './utils' +import { codes, invalid, name, valid, validOnlyByFormat } from './countries_vat_lists/sweden.vat' +import { addCharsToString, checkInvalidVat, checkOnlyValidFormatVat, checkValidVat } from './utils' describe('Sweden', () => { - it('should return true result for valid VATs', () => { + it('should return "true" result for valid VATs', () => { valid.forEach(vat => checkValidVat(vat, [sweden], codes, name)) }) - it('should return true result for valid VATs with extra dash characters', () => { + it('should return "true" for "isSupportedCountry" and "isValidFormat" fields, but "false" for "isValid" for VATs that match format but still invalid', () => { + validOnlyByFormat.forEach(vat => checkOnlyValidFormatVat(vat, [sweden], codes, name)) + }) + + it('should return "true" result for valid VATs with extra dash characters', () => { valid .map(vat => addCharsToString(vat, '-')) .forEach(vat => checkValidVat(vat, [sweden], codes, name)) }) - it('should return true result for valid VATs with extra space characters', () => { + it('should return "true" result for valid VATs with extra space characters', () => { valid .map(vat => addCharsToString(vat, ' ')) .forEach(vat => checkValidVat(vat, [sweden], codes, name)) }) - it('should return false result for invalid VATs', () => { - invalid.forEach(vat => checkInValidVat(vat, [sweden])) + it('should return "false" result for invalid VATs', () => { + invalid.forEach(vat => checkInvalidVat(vat, [sweden])) }) }) diff --git a/test/switzerland.spec.js b/test/switzerland.spec.js index d878d7f..62f14e3 100644 --- a/test/switzerland.spec.js +++ b/test/switzerland.spec.js @@ -1,27 +1,31 @@ import { switzerland } from '../index' -import { codes, invalid, name, valid } from './countries_vat_lists/switzerland.vat' -import { addCharsToString, checkInValidVat, checkValidVat } from './utils' +import { codes, invalid, name, valid, validOnlyByFormat } from './countries_vat_lists/switzerland.vat' +import { addCharsToString, checkInvalidVat, checkOnlyValidFormatVat, checkValidVat } from './utils' describe('Switzerland', () => { - it('should return true result for valid VATs', () => { + it('should return "true" result for valid VATs', () => { valid.forEach(vat => checkValidVat(vat, [switzerland], codes, name)) }) - it('should return true result for valid VATs with extra dash characters', () => { + it('should return "true" for "isSupportedCountry" and "isValidFormat" fields, but "false" for "isValid" for VATs that match format but still invalid', () => { + validOnlyByFormat.forEach(vat => checkOnlyValidFormatVat(vat, [switzerland], codes, name)) + }) + + it('should return "true" result for valid VATs with extra dash characters', () => { valid .map(vat => addCharsToString(vat, '-')) .forEach(vat => checkValidVat(vat, [switzerland], codes, name)) }) - it('should return true result for valid VATs with extra space characters', () => { + it('should return "true" result for valid VATs with extra space characters', () => { valid .map(vat => addCharsToString(vat, ' ')) .forEach(vat => checkValidVat(vat, [switzerland], codes, name)) }) - it('should return false result for invalid VATs', () => { - invalid.forEach(vat => checkInValidVat(vat, [switzerland])) + it('should return "false" result for invalid VATs', () => { + invalid.forEach(vat => checkInvalidVat(vat, [switzerland])) }) }) diff --git a/test/unitedKingdom.spec.js b/test/unitedKingdom.spec.js index dde12b9..dade85d 100644 --- a/test/unitedKingdom.spec.js +++ b/test/unitedKingdom.spec.js @@ -1,27 +1,31 @@ import { unitedKingdom } from '../index' -import { codes, invalid, name, valid } from './countries_vat_lists/unitedKingdom.vat' -import { addCharsToString, checkInValidVat, checkValidVat } from './utils' +import { codes, invalid, name, valid, validOnlyByFormat } from './countries_vat_lists/unitedKingdom.vat' +import { addCharsToString, checkInvalidVat, checkOnlyValidFormatVat, checkValidVat } from './utils' describe('United Kingdom', () => { - it('should return true result for valid VATs', () => { + it('should return "true" result for valid VATs', () => { valid.forEach(vat => checkValidVat(vat, [unitedKingdom], codes, name)) }) - it('should return true result for valid VATs with extra dash characters', () => { + it('should return "true" for "isSupportedCountry" and "isValidFormat" fields, but "false" for "isValid" for VATs that match format but still invalid', () => { + validOnlyByFormat.forEach(vat => checkOnlyValidFormatVat(vat, [unitedKingdom], codes, name)) + }) + + it('should return "true" result for valid VATs with extra dash characters', () => { valid .map(vat => addCharsToString(vat, '-')) .forEach(vat => checkValidVat(vat, [unitedKingdom], codes, name)) }) - it('should return true result for valid VATs with extra space characters', () => { + it('should return "true" result for valid VATs with extra space characters', () => { valid .map(vat => addCharsToString(vat, ' ')) .forEach(vat => checkValidVat(vat, [unitedKingdom], codes, name)) }) - it('should return false result for invalid VATs', () => { - invalid.forEach(vat => checkInValidVat(vat, [unitedKingdom])) + it('should return "false" result for invalid VATs', () => { + invalid.forEach(vat => checkInvalidVat(vat, [unitedKingdom])) }) }) diff --git a/test/utils.js b/test/utils.js index 765b063..f3ada89 100644 --- a/test/utils.js +++ b/test/utils.js @@ -6,18 +6,31 @@ export function checkValidVat(vat, countriesList, codes, name) { if (!result.isValid) console.info('Invalid VAT:', vat); expect(result.isValid).toBe(true) + expect(result.isSupportedCountry).toBe(true) + expect(result.isValidFormat).toBe(true) expect(result.country.name).toBe(name) expect(result.country.isoCode.short).toBe(codes[0]) expect(result.country.isoCode.long).toBe(codes[1]) expect(result.country.isoCode.numeric).toBe(codes[2]) } -export function checkInValidVat(vat, countriesList) { +export function checkInvalidVat(vat, countriesList) { const result = checkVAT(vat, countriesList) if (result.isValid) console.info('Following VAT should be invalid:', vat); expect(result.isValid).toBe(false) } + +export function checkOnlyValidFormatVat(vat, countriesList) { + const result = checkVAT(vat, countriesList) + + if (!result.isValid) console.info('Invalid VAT:', vat); + + expect(result.isValid).toBe(false) + expect(result.isSupportedCountry).toBe(true) + expect(result.isValidFormat).toBe(true) +} + export function addCharsToString(item, char) { const val = item.split('') val.splice(3, 0, char) diff --git a/types/lib/jsvat.d.ts b/types/lib/jsvat.d.ts index 6592716..afa2865 100644 --- a/types/lib/jsvat.d.ts +++ b/types/lib/jsvat.d.ts @@ -19,12 +19,11 @@ export interface Country { }) => boolean; rules: Rules; } -export interface CountryWithFormatValid extends Country { - formatValid: boolean; -} export interface VatCheckResult { value?: string; isValid: boolean; + isValidFormat: boolean; + isSupportedCountry: boolean; country?: { name: string; isoCode: { @@ -32,7 +31,6 @@ export interface VatCheckResult { long: string; numeric: string; }; - formatValid: boolean; }; } export declare function checkVAT(vat: string, countriesList?: ReadonlyArray): VatCheckResult; diff --git a/yarn.lock b/yarn.lock index e2e2e08..d2930bf 100644 --- a/yarn.lock +++ b/yarn.lock @@ -398,20 +398,27 @@ "@babel/helper-create-regexp-features-plugin" "^7.8.8" "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-syntax-async-generators@^7.8.0": +"@babel/plugin-syntax-async-generators@^7.8.0", "@babel/plugin-syntax-async-generators@^7.8.4": version "7.8.4" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz#a983fb1aeb2ec3f6ed042a210f640e90e786fe0d" integrity sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw== dependencies: "@babel/helper-plugin-utils" "^7.8.0" -"@babel/plugin-syntax-bigint@^7.0.0": +"@babel/plugin-syntax-bigint@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-bigint/-/plugin-syntax-bigint-7.8.3.tgz#4c9a6f669f5d0cdf1b90a1671e9a146be5300cea" integrity sha512-wnTnFlG+YxQm3vDxpGE57Pj0srRU4sHE/mDkt1qv2YJJSeUAec2ma4WLUnUPeKjyrfntVwe/N6dCXpU+zL3Npg== dependencies: "@babel/helper-plugin-utils" "^7.8.0" +"@babel/plugin-syntax-class-properties@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.8.3.tgz#6cb933a8872c8d359bfde69bbeaae5162fd1e8f7" + integrity sha512-UcAyQWg2bAN647Q+O811tG9MrJ38Z10jjhQdKNAL8fsyPzE3cCN/uT+f55cFVY4aGO4jqJAvmqsuY3GQDwAoXg== + dependencies: + "@babel/helper-plugin-utils" "^7.8.3" + "@babel/plugin-syntax-dynamic-import@^7.8.0": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-dynamic-import/-/plugin-syntax-dynamic-import-7.8.3.tgz#62bf98b2da3cd21d626154fc96ee5b3cb68eacb3" @@ -419,14 +426,21 @@ dependencies: "@babel/helper-plugin-utils" "^7.8.0" -"@babel/plugin-syntax-json-strings@^7.8.0": +"@babel/plugin-syntax-json-strings@^7.8.0", "@babel/plugin-syntax-json-strings@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.8.3.tgz#01ca21b668cd8218c9e640cb6dd88c5412b2c96a" integrity sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA== dependencies: "@babel/helper-plugin-utils" "^7.8.0" -"@babel/plugin-syntax-nullish-coalescing-operator@^7.8.0": +"@babel/plugin-syntax-logical-assignment-operators@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.8.3.tgz#3995d7d7ffff432f6ddc742b47e730c054599897" + integrity sha512-Zpg2Sgc++37kuFl6ppq2Q7Awc6E6AIW671x5PY8E/f7MCIyPPGK/EoeZXvvY3P42exZ3Q4/t3YOzP/HiN79jDg== + dependencies: + "@babel/helper-plugin-utils" "^7.8.3" + +"@babel/plugin-syntax-nullish-coalescing-operator@^7.8.0", "@babel/plugin-syntax-nullish-coalescing-operator@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz#167ed70368886081f74b5c36c65a88c03b66d1a9" integrity sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ== @@ -440,27 +454,21 @@ dependencies: "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-syntax-object-rest-spread@^7.0.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.2.0.tgz#3b7a3e733510c57e820b9142a6579ac8b0dfad2e" - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - -"@babel/plugin-syntax-object-rest-spread@^7.8.0": +"@babel/plugin-syntax-object-rest-spread@^7.8.0", "@babel/plugin-syntax-object-rest-spread@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz#60e225edcbd98a640332a2e72dd3e66f1af55871" integrity sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA== dependencies: "@babel/helper-plugin-utils" "^7.8.0" -"@babel/plugin-syntax-optional-catch-binding@^7.8.0": +"@babel/plugin-syntax-optional-catch-binding@^7.8.0", "@babel/plugin-syntax-optional-catch-binding@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.8.3.tgz#6111a265bcfb020eb9efd0fdfd7d26402b9ed6c1" integrity sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q== dependencies: "@babel/helper-plugin-utils" "^7.8.0" -"@babel/plugin-syntax-optional-chaining@^7.8.0": +"@babel/plugin-syntax-optional-chaining@^7.8.0", "@babel/plugin-syntax-optional-chaining@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz#4f69c2ab95167e0180cd5336613f8c5788f7d48a" integrity sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg== @@ -892,43 +900,43 @@ resolved "https://registry.yarnpkg.com/@istanbuljs/schema/-/schema-0.1.2.tgz#26520bf09abe4a5644cd5414e37125a8954241dd" integrity sha512-tsAQNx32a8CoFhjhijUIhI4kccIAgmGhy8LZMZgGfmXcpMbPRUqn5LWmgRttILi6yeGmBJd2xsPkFMs0PzgPCw== -"@jest/console@^25.2.6": - version "25.2.6" - resolved "https://registry.yarnpkg.com/@jest/console/-/console-25.2.6.tgz#f594847ec8aef3cf27f448abe97e76e491212e97" - integrity sha512-bGp+0PicZVCEhb+ifnW9wpKWONNdkhtJsRE7ap729hiAfTvCN6VhGx0s/l/V/skA2pnyqq+N/7xl9ZWfykDpsg== +"@jest/console@^25.3.0": + version "25.3.0" + resolved "https://registry.yarnpkg.com/@jest/console/-/console-25.3.0.tgz#33b56b81238427bf3ebe3f7b3378d2f79cdbd409" + integrity sha512-LvSDNqpmZIZyweFaEQ6wKY7CbexPitlsLHGJtcooNECo0An/w49rFhjCJzu6efeb6+a3ee946xss1Jcd9r03UQ== dependencies: "@jest/source-map" "^25.2.6" chalk "^3.0.0" - jest-util "^25.2.6" + jest-util "^25.3.0" slash "^3.0.0" -"@jest/core@^25.2.7": - version "25.2.7" - resolved "https://registry.yarnpkg.com/@jest/core/-/core-25.2.7.tgz#58d697687e94ee644273d15e4eed6a20e27187cd" - integrity sha512-Nd6ELJyR+j0zlwhzkfzY70m04hAur0VnMwJXVe4VmmD/SaQ6DEyal++ERQ1sgyKIKKEqRuui6k/R0wHLez4P+g== +"@jest/core@^25.3.0": + version "25.3.0" + resolved "https://registry.yarnpkg.com/@jest/core/-/core-25.3.0.tgz#80f97a7a8b59dde741a24f30871cc26d0197d426" + integrity sha512-+D5a/tFf6pA/Gqft2DLBp/yeSRgXhlJ+Wpst0X/ZkfTRP54qDR3C61VfHwaex+GzZBiTcE9vQeoZ2v5T10+Mqw== dependencies: - "@jest/console" "^25.2.6" - "@jest/reporters" "^25.2.6" - "@jest/test-result" "^25.2.6" - "@jest/transform" "^25.2.6" - "@jest/types" "^25.2.6" + "@jest/console" "^25.3.0" + "@jest/reporters" "^25.3.0" + "@jest/test-result" "^25.3.0" + "@jest/transform" "^25.3.0" + "@jest/types" "^25.3.0" ansi-escapes "^4.2.1" chalk "^3.0.0" exit "^0.1.2" graceful-fs "^4.2.3" - jest-changed-files "^25.2.6" - jest-config "^25.2.7" - jest-haste-map "^25.2.6" - jest-message-util "^25.2.6" + jest-changed-files "^25.3.0" + jest-config "^25.3.0" + jest-haste-map "^25.3.0" + jest-message-util "^25.3.0" jest-regex-util "^25.2.6" - jest-resolve "^25.2.6" - jest-resolve-dependencies "^25.2.7" - jest-runner "^25.2.7" - jest-runtime "^25.2.7" - jest-snapshot "^25.2.7" - jest-util "^25.2.6" - jest-validate "^25.2.6" - jest-watcher "^25.2.7" + jest-resolve "^25.3.0" + jest-resolve-dependencies "^25.3.0" + jest-runner "^25.3.0" + jest-runtime "^25.3.0" + jest-snapshot "^25.3.0" + jest-util "^25.3.0" + jest-validate "^25.3.0" + jest-watcher "^25.3.0" micromatch "^4.0.2" p-each-series "^2.1.0" realpath-native "^2.0.0" @@ -936,36 +944,36 @@ slash "^3.0.0" strip-ansi "^6.0.0" -"@jest/environment@^25.2.6": - version "25.2.6" - resolved "https://registry.yarnpkg.com/@jest/environment/-/environment-25.2.6.tgz#8f7931e79abd81893ce88b7306f0cc4744835000" - integrity sha512-17WIw+wCb9drRNFw1hi8CHah38dXVdOk7ga9exThhGtXlZ9mK8xH4DjSB9uGDGXIWYSHmrxoyS6KJ7ywGr7bzg== +"@jest/environment@^25.3.0": + version "25.3.0" + resolved "https://registry.yarnpkg.com/@jest/environment/-/environment-25.3.0.tgz#587f28ddb4b0dfe97404d3d4a4c9dbfa0245fb2e" + integrity sha512-vgooqwJTHLLak4fE+TaCGeYP7Tz1Y3CKOsNxR1sE0V3nx3KRUHn3NUnt+wbcfd5yQWKZQKAfW6wqbuwQLrXo3g== dependencies: - "@jest/fake-timers" "^25.2.6" - "@jest/types" "^25.2.6" - jest-mock "^25.2.6" + "@jest/fake-timers" "^25.3.0" + "@jest/types" "^25.3.0" + jest-mock "^25.3.0" -"@jest/fake-timers@^25.2.6": - version "25.2.6" - resolved "https://registry.yarnpkg.com/@jest/fake-timers/-/fake-timers-25.2.6.tgz#239dbde3f56badf7d05bcf888f5d669296077cad" - integrity sha512-A6qtDIA2zg/hVgUJJYzQSHFBIp25vHdSxW/s4XmTJAYxER6eL0NQdQhe4+232uUSviKitubHGXXirt5M7blPiA== +"@jest/fake-timers@^25.3.0": + version "25.3.0" + resolved "https://registry.yarnpkg.com/@jest/fake-timers/-/fake-timers-25.3.0.tgz#995aad36d5c8984165ca5db12e740ab8dbf7042a" + integrity sha512-NHAj7WbsyR3qBJPpBwSwqaq2WluIvUQsyzpJTN7XDVk7VnlC/y1BAnaYZL3vbPIP8Nhm0Ae5DJe0KExr/SdMJQ== dependencies: - "@jest/types" "^25.2.6" - jest-message-util "^25.2.6" - jest-mock "^25.2.6" - jest-util "^25.2.6" + "@jest/types" "^25.3.0" + jest-message-util "^25.3.0" + jest-mock "^25.3.0" + jest-util "^25.3.0" lolex "^5.0.0" -"@jest/reporters@^25.2.6": - version "25.2.6" - resolved "https://registry.yarnpkg.com/@jest/reporters/-/reporters-25.2.6.tgz#6d87e40fb15adb69e22bb83aa02a4d88b2253b5f" - integrity sha512-DRMyjaxcd6ZKctiXNcuVObnPwB1eUs7xrUVu0J2V0p5/aZJei5UM9GL3s/bmN4hRV8Mt3zXh+/9X2o0Q4ClZIA== +"@jest/reporters@^25.3.0": + version "25.3.0" + resolved "https://registry.yarnpkg.com/@jest/reporters/-/reporters-25.3.0.tgz#7f39f0e6911561cc5112a1b54656de18faee269b" + integrity sha512-1u0ZBygs0C9DhdYgLCrRfZfNKQa+9+J7Uo+Z9z0RWLHzgsxhoG32lrmMOtUw48yR6bLNELdvzormwUqSk4H4Vg== dependencies: "@bcoe/v8-coverage" "^0.2.3" - "@jest/console" "^25.2.6" - "@jest/test-result" "^25.2.6" - "@jest/transform" "^25.2.6" - "@jest/types" "^25.2.6" + "@jest/console" "^25.3.0" + "@jest/test-result" "^25.3.0" + "@jest/transform" "^25.3.0" + "@jest/types" "^25.3.0" chalk "^3.0.0" collect-v8-coverage "^1.0.0" exit "^0.1.2" @@ -974,10 +982,10 @@ istanbul-lib-instrument "^4.0.0" istanbul-lib-report "^3.0.0" istanbul-lib-source-maps "^4.0.0" - istanbul-reports "^3.0.0" - jest-haste-map "^25.2.6" - jest-resolve "^25.2.6" - jest-util "^25.2.6" + istanbul-reports "^3.0.2" + jest-haste-map "^25.3.0" + jest-resolve "^25.3.0" + jest-util "^25.3.0" jest-worker "^25.2.6" slash "^3.0.0" source-map "^0.6.0" @@ -996,41 +1004,41 @@ graceful-fs "^4.2.3" source-map "^0.6.0" -"@jest/test-result@^25.2.6": - version "25.2.6" - resolved "https://registry.yarnpkg.com/@jest/test-result/-/test-result-25.2.6.tgz#f6082954955313eb96f6cabf9fb14f8017826916" - integrity sha512-gmGgcF4qz/pkBzyfJuVHo2DA24kIgVQ5Pf/VpW4QbyMLSegi8z+9foSZABfIt5se6k0fFj/3p/vrQXdaOgit0w== +"@jest/test-result@^25.3.0": + version "25.3.0" + resolved "https://registry.yarnpkg.com/@jest/test-result/-/test-result-25.3.0.tgz#137fab5e5c6fed36e5d40735d1eb029325e3bf06" + integrity sha512-mqrGuiiPXl1ap09Mydg4O782F3ouDQfsKqtQzIjitpwv3t1cHDwCto21jThw6WRRE+dKcWQvLG70GpyLJICfGw== dependencies: - "@jest/console" "^25.2.6" - "@jest/types" "^25.2.6" + "@jest/console" "^25.3.0" + "@jest/types" "^25.3.0" "@types/istanbul-lib-coverage" "^2.0.0" collect-v8-coverage "^1.0.0" -"@jest/test-sequencer@^25.2.7": - version "25.2.7" - resolved "https://registry.yarnpkg.com/@jest/test-sequencer/-/test-sequencer-25.2.7.tgz#e4331f7b4850e34289b9a5c8ec8a2c03b400da8f" - integrity sha512-s2uYGOXONDSTJQcZJ9A3Zkg3hwe53RlX1HjUNqjUy3HIqwgwCKJbnAKYsORPbhxXi3ARMKA7JNBi9arsTxXoYw== +"@jest/test-sequencer@^25.3.0": + version "25.3.0" + resolved "https://registry.yarnpkg.com/@jest/test-sequencer/-/test-sequencer-25.3.0.tgz#271ad5f2b8f8137d092ccedc87e16a50f8676209" + integrity sha512-Xvns3xbji7JCvVcDGvqJ/pf4IpmohPODumoPEZJ0/VgC5gI4XaNVIBET2Dq5Czu6Gk3xFcmhtthh/MBOTljdNg== dependencies: - "@jest/test-result" "^25.2.6" - jest-haste-map "^25.2.6" - jest-runner "^25.2.7" - jest-runtime "^25.2.7" + "@jest/test-result" "^25.3.0" + jest-haste-map "^25.3.0" + jest-runner "^25.3.0" + jest-runtime "^25.3.0" -"@jest/transform@^25.2.6": - version "25.2.6" - resolved "https://registry.yarnpkg.com/@jest/transform/-/transform-25.2.6.tgz#007fd946dedf12d2a9eb5d4154faf1991d5f61ff" - integrity sha512-rZnjCjZf9avPOf9q/w9RUZ9Uc29JmB53uIXNJmNz04QbDMD5cR/VjfikiMKajBsXe2vnFl5sJ4RTt+9HPicauQ== +"@jest/transform@^25.3.0": + version "25.3.0" + resolved "https://registry.yarnpkg.com/@jest/transform/-/transform-25.3.0.tgz#083c5447d5307d9b9494d6968115b647460e71f1" + integrity sha512-W01p8kTDvvEX6kd0tJc7Y5VdYyFaKwNWy1HQz6Jqlhu48z/8Gxp+yFCDVj+H8Rc7ezl3Mg0hDaGuFVkmHOqirg== dependencies: "@babel/core" "^7.1.0" - "@jest/types" "^25.2.6" + "@jest/types" "^25.3.0" babel-plugin-istanbul "^6.0.0" chalk "^3.0.0" convert-source-map "^1.4.0" fast-json-stable-stringify "^2.0.0" graceful-fs "^4.2.3" - jest-haste-map "^25.2.6" + jest-haste-map "^25.3.0" jest-regex-util "^25.2.6" - jest-util "^25.2.6" + jest-util "^25.3.0" micromatch "^4.0.2" pirates "^4.0.1" realpath-native "^2.0.0" @@ -1038,10 +1046,10 @@ source-map "^0.6.1" write-file-atomic "^3.0.0" -"@jest/types@^25.2.6": - version "25.2.6" - resolved "https://registry.yarnpkg.com/@jest/types/-/types-25.2.6.tgz#c12f44af9bed444438091e4b59e7ed05f8659cb6" - integrity sha512-myJTTV37bxK7+3NgKc4Y/DlQ5q92/NOwZsZ+Uch7OXdElxOg61QYc72fPYNAjlvbnJ2YvbXLamIsa9tj48BmyQ== +"@jest/types@^25.3.0": + version "25.3.0" + resolved "https://registry.yarnpkg.com/@jest/types/-/types-25.3.0.tgz#88f94b277a1d028fd7117bc1f74451e0fc2131e7" + integrity sha512-UkaDNewdqXAmCDbN2GlUM6amDKS78eCqiw/UmF5nE0mmLTd6moJkiZJML/X52Ke3LH7Swhw883IRXq8o9nWjVw== dependencies: "@types/istanbul-lib-coverage" "^2.0.0" "@types/istanbul-reports" "^1.1.1" @@ -1055,9 +1063,10 @@ dependencies: type-detect "4.0.8" -"@types/babel__core@^7.1.0": - version "7.1.2" - resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.1.2.tgz#608c74f55928033fce18b99b213c16be4b3d114f" +"@types/babel__core@^7.1.7": + version "7.1.7" + resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.1.7.tgz#1dacad8840364a57c98d0dd4855c6dd3752c6b89" + integrity sha512-RL62NqSFPCDK2FM1pSDH0scHpJvsXtZNiYlMB73DgPBaG1E38ZYVL+ei5EkWRbr+KC4YNiAUNBnRj+bgwpgjMw== dependencies: "@babel/parser" "^7.1.0" "@babel/types" "^7.0.0" @@ -1282,16 +1291,16 @@ babel-code-frame@^6.26.0: esutils "^2.0.2" js-tokens "^3.0.2" -babel-jest@^25.2.6: - version "25.2.6" - resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-25.2.6.tgz#fe67ff4d0db3626ca8082da8881dd5e84e07ae75" - integrity sha512-MDJOAlwtIeIQiGshyX0d2PxTbV73xZMpNji40ivVTPQOm59OdRR9nYCkffqI7ugtsK4JR98HgNKbDbuVf4k5QQ== +babel-jest@^25.3.0: + version "25.3.0" + resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-25.3.0.tgz#999d0c19e8427f66b796bf9ea233eedf087b957c" + integrity sha512-qiXeX1Cmw4JZ5yQ4H57WpkO0MZ61Qj+YnsVUwAMnDV5ls+yHon11XjarDdgP7H8lTmiEi6biiZA8y3Tmvx6pCg== dependencies: - "@jest/transform" "^25.2.6" - "@jest/types" "^25.2.6" - "@types/babel__core" "^7.1.0" + "@jest/transform" "^25.3.0" + "@jest/types" "^25.3.0" + "@types/babel__core" "^7.1.7" babel-plugin-istanbul "^6.0.0" - babel-preset-jest "^25.2.6" + babel-preset-jest "^25.3.0" chalk "^3.0.0" slash "^3.0.0" @@ -1342,14 +1351,29 @@ babel-plugin-transform-strict-mode@^6.24.1: babel-runtime "^6.22.0" babel-types "^6.24.1" -babel-preset-jest@^25.2.6: - version "25.2.6" - resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-25.2.6.tgz#5d3f7c99e2a8508d61775c9d68506d143b7f71b5" - integrity sha512-Xh2eEAwaLY9+SyMt/xmGZDnXTW/7pSaBPG0EMo7EuhvosFKVWYB6CqwYD31DaEQuoTL090oDZ0FEqygffGRaSQ== +babel-preset-current-node-syntax@^0.1.2: + version "0.1.2" + resolved "https://registry.yarnpkg.com/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-0.1.2.tgz#fb4a4c51fe38ca60fede1dc74ab35eb843cb41d6" + integrity sha512-u/8cS+dEiK1SFILbOC8/rUI3ml9lboKuuMvZ/4aQnQmhecQAgPw5ew066C1ObnEAUmlx7dv/s2z52psWEtLNiw== + dependencies: + "@babel/plugin-syntax-async-generators" "^7.8.4" + "@babel/plugin-syntax-bigint" "^7.8.3" + "@babel/plugin-syntax-class-properties" "^7.8.3" + "@babel/plugin-syntax-json-strings" "^7.8.3" + "@babel/plugin-syntax-logical-assignment-operators" "^7.8.3" + "@babel/plugin-syntax-nullish-coalescing-operator" "^7.8.3" + "@babel/plugin-syntax-numeric-separator" "^7.8.3" + "@babel/plugin-syntax-object-rest-spread" "^7.8.3" + "@babel/plugin-syntax-optional-catch-binding" "^7.8.3" + "@babel/plugin-syntax-optional-chaining" "^7.8.3" + +babel-preset-jest@^25.3.0: + version "25.3.0" + resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-25.3.0.tgz#9ab40aee52a19bdc52b8b1ec2403d5914ac3d86b" + integrity sha512-tjdvLKNMwDI9r+QWz9sZUQGTq1dpoxjUqFUpEasAc7MOtHg9XuLT2fx0udFG+k1nvMV0WvHHVAN7VmCZ+1Zxbw== dependencies: - "@babel/plugin-syntax-bigint" "^7.0.0" - "@babel/plugin-syntax-object-rest-spread" "^7.0.0" babel-plugin-jest-hoist "^25.2.6" + babel-preset-current-node-syntax "^0.1.2" babel-runtime@^6.22.0, babel-runtime@^6.26.0: version "6.26.0" @@ -1908,16 +1932,16 @@ expand-brackets@^2.1.4: snapdragon "^0.8.1" to-regex "^3.0.1" -expect@^25.2.7: - version "25.2.7" - resolved "https://registry.yarnpkg.com/expect/-/expect-25.2.7.tgz#509b79f47502835f4071ff3ecc401f2eaecca709" - integrity sha512-yA+U2Ph0MkMsJ9N8q5hs9WgWI6oJYfecdXta6LkP/alY/jZZL1MHlJ2wbLh60Ucqf3G+51ytbqV3mlGfmxkpNw== +expect@^25.3.0: + version "25.3.0" + resolved "https://registry.yarnpkg.com/expect/-/expect-25.3.0.tgz#5fd36e51befd05afb7184bc954f8a4792d184c71" + integrity sha512-buboTXML2h/L0Kh44Ys2Cx49mX20ISc5KDirkxIs3Q9AJv0kazweUAbukegr+nHDOvFRKmxdojjIHCjqAceYfg== dependencies: - "@jest/types" "^25.2.6" + "@jest/types" "^25.3.0" ansi-styles "^4.0.0" jest-get-type "^25.2.6" - jest-matcher-utils "^25.2.7" - jest-message-util "^25.2.6" + jest-matcher-utils "^25.3.0" + jest-message-util "^25.3.0" jest-regex-util "^25.2.6" extend-shallow@^2.0.1: @@ -2406,7 +2430,7 @@ istanbul-lib-source-maps@^4.0.0: istanbul-lib-coverage "^3.0.0" source-map "^0.6.1" -istanbul-reports@^3.0.0: +istanbul-reports@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/istanbul-reports/-/istanbul-reports-3.0.2.tgz#d593210e5000683750cb09fc0644e4b6e27fd53b" integrity sha512-9tZvz7AiR3PEDNGiV9vIouQ/EAcqMXFmkcA1CDFTwOB98OZVDL0PH9glHotf5Ugp6GCOTypfzGWI/OqjWNCRUw== @@ -2414,108 +2438,108 @@ istanbul-reports@^3.0.0: html-escaper "^2.0.0" istanbul-lib-report "^3.0.0" -jest-changed-files@^25.2.6: - version "25.2.6" - resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-25.2.6.tgz#7d569cd6b265b1a84db3914db345d9c452f26b71" - integrity sha512-F7l2m5n55jFnJj4ItB9XbAlgO+6umgvz/mdK76BfTd2NGkvGf9x96hUXP/15a1K0k14QtVOoutwpRKl360msvg== +jest-changed-files@^25.3.0: + version "25.3.0" + resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-25.3.0.tgz#85d8de6f4bd13dafda9d7f1e3f2565fc0e183c78" + integrity sha512-eqd5hyLbUjIVvLlJ3vQ/MoPxsxfESVXG9gvU19XXjKzxr+dXmZIqCXiY0OiYaibwlHZBJl2Vebkc0ADEMzCXew== dependencies: - "@jest/types" "^25.2.6" + "@jest/types" "^25.3.0" execa "^3.2.0" throat "^5.0.0" -jest-cli@^25.2.7: - version "25.2.7" - resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-25.2.7.tgz#515b61fee402c397ffa8d570532f7b039c3159f4" - integrity sha512-OOAZwY4Jkd3r5WhVM5L3JeLNFaylvHUczMLxQDVLrrVyb1Cy+DNJ6MVsb5TLh6iBklB42m5TOP+IbOgKGGOtMw== +jest-cli@^25.3.0: + version "25.3.0" + resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-25.3.0.tgz#d9e11f5700cc5946583cf0d01a9bdebceed448d2" + integrity sha512-XpNQPlW1tzpP7RGG8dxpkRegYDuLjzSiENu92+CYM87nEbmEPb3b4+yo8xcsHOnj0AG7DUt9b3uG8LuHI3MDzw== dependencies: - "@jest/core" "^25.2.7" - "@jest/test-result" "^25.2.6" - "@jest/types" "^25.2.6" + "@jest/core" "^25.3.0" + "@jest/test-result" "^25.3.0" + "@jest/types" "^25.3.0" chalk "^3.0.0" exit "^0.1.2" import-local "^3.0.2" is-ci "^2.0.0" - jest-config "^25.2.7" - jest-util "^25.2.6" - jest-validate "^25.2.6" + jest-config "^25.3.0" + jest-util "^25.3.0" + jest-validate "^25.3.0" prompts "^2.0.1" realpath-native "^2.0.0" yargs "^15.3.1" -jest-config@^25.2.7: - version "25.2.7" - resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-25.2.7.tgz#a14e5b96575987ce913dd9fc20ac8cd4b35a8c29" - integrity sha512-rIdPPXR6XUxi+7xO4CbmXXkE6YWprvlKc4kg1SrkCL2YV5m/8MkHstq9gBZJ19Qoa3iz/GP+0sTG/PcIwkFojg== +jest-config@^25.3.0: + version "25.3.0" + resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-25.3.0.tgz#112b5e2f2e57dec4501dd2fe979044c06fb1317e" + integrity sha512-CmF1JnNWFmoCSPC4tnU52wnVBpuxHjilA40qH/03IHxIevkjUInSMwaDeE6ACfxMPTLidBGBCO3EbxvzPbo8wA== dependencies: "@babel/core" "^7.1.0" - "@jest/test-sequencer" "^25.2.7" - "@jest/types" "^25.2.6" - babel-jest "^25.2.6" + "@jest/test-sequencer" "^25.3.0" + "@jest/types" "^25.3.0" + babel-jest "^25.3.0" chalk "^3.0.0" deepmerge "^4.2.2" glob "^7.1.1" - jest-environment-jsdom "^25.2.6" - jest-environment-node "^25.2.6" + jest-environment-jsdom "^25.3.0" + jest-environment-node "^25.3.0" jest-get-type "^25.2.6" - jest-jasmine2 "^25.2.7" + jest-jasmine2 "^25.3.0" jest-regex-util "^25.2.6" - jest-resolve "^25.2.6" - jest-util "^25.2.6" - jest-validate "^25.2.6" + jest-resolve "^25.3.0" + jest-util "^25.3.0" + jest-validate "^25.3.0" micromatch "^4.0.2" - pretty-format "^25.2.6" + pretty-format "^25.3.0" realpath-native "^2.0.0" -jest-diff@^25.2.6: - version "25.2.6" - resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-25.2.6.tgz#a6d70a9ab74507715ea1092ac513d1ab81c1b5e7" - integrity sha512-KuadXImtRghTFga+/adnNrv9s61HudRMR7gVSbP35UKZdn4IK2/0N0PpGZIqtmllK9aUyye54I3nu28OYSnqOg== +jest-diff@^25.3.0: + version "25.3.0" + resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-25.3.0.tgz#0d7d6f5d6171e5dacde9e05be47b3615e147c26f" + integrity sha512-vyvs6RPoVdiwARwY4kqFWd4PirPLm2dmmkNzKqo38uZOzJvLee87yzDjIZLmY1SjM3XR5DwsUH+cdQ12vgqi1w== dependencies: chalk "^3.0.0" diff-sequences "^25.2.6" jest-get-type "^25.2.6" - pretty-format "^25.2.6" + pretty-format "^25.3.0" -jest-docblock@^25.2.6: - version "25.2.6" - resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-25.2.6.tgz#4b09f1e7b7d6b3f39242ef3647ac7106770f722b" - integrity sha512-VAYrljEq0upq0oERfIaaNf28gC6p9gORndhHstCYF8NWGNQJnzoaU//S475IxfWMk4UjjVmS9rJKLe5Jjjbixw== +jest-docblock@^25.3.0: + version "25.3.0" + resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-25.3.0.tgz#8b777a27e3477cd77a168c05290c471a575623ef" + integrity sha512-aktF0kCar8+zxRHxQZwxMy70stc9R1mOmrLsT5VO3pIT0uzGRSDAXxSlz4NqQWpuLjPpuMhPRl7H+5FRsvIQAg== dependencies: detect-newline "^3.0.0" -jest-each@^25.2.6: - version "25.2.6" - resolved "https://registry.yarnpkg.com/jest-each/-/jest-each-25.2.6.tgz#026f6dea2ccc443c35cea793265620aab1b278b6" - integrity sha512-OgQ01VINaRD6idWJOhCYwUc5EcgHBiFlJuw+ON2VgYr7HLtMFyCcuo+3mmBvuLUH4QudREZN7cDCZviknzsaJQ== +jest-each@^25.3.0: + version "25.3.0" + resolved "https://registry.yarnpkg.com/jest-each/-/jest-each-25.3.0.tgz#a319eecf1f6076164ab86f99ca166a55b96c0bd4" + integrity sha512-aBfS4VOf/Qs95yUlX6d6WBv0szvOcTkTTyCIaLuQGj4bSHsT+Wd9dDngVHrCe5uytxpN8VM+NAloI6nbPjXfXw== dependencies: - "@jest/types" "^25.2.6" + "@jest/types" "^25.3.0" chalk "^3.0.0" jest-get-type "^25.2.6" - jest-util "^25.2.6" - pretty-format "^25.2.6" - -jest-environment-jsdom@^25.2.6: - version "25.2.6" - resolved "https://registry.yarnpkg.com/jest-environment-jsdom/-/jest-environment-jsdom-25.2.6.tgz#b7ae41c6035905b8e58d63a8f63cf8eaa00af279" - integrity sha512-/o7MZIhGmLGIEG5j7r5B5Az0umWLCHU+F5crwfbm0BzC4ybHTJZOQTFQWhohBg+kbTCNOuftMcqHlVkVduJCQQ== - dependencies: - "@jest/environment" "^25.2.6" - "@jest/fake-timers" "^25.2.6" - "@jest/types" "^25.2.6" - jest-mock "^25.2.6" - jest-util "^25.2.6" + jest-util "^25.3.0" + pretty-format "^25.3.0" + +jest-environment-jsdom@^25.3.0: + version "25.3.0" + resolved "https://registry.yarnpkg.com/jest-environment-jsdom/-/jest-environment-jsdom-25.3.0.tgz#c493ab8c41f28001520c70ef67dd88b88be6af05" + integrity sha512-jdE4bQN+k2QEZ9sWOxsqDJvMzbdFSCN/4tw8X0TQaCqyzKz58PyEf41oIr4WO7ERdp7WaJGBSUKF7imR3UW1lg== + dependencies: + "@jest/environment" "^25.3.0" + "@jest/fake-timers" "^25.3.0" + "@jest/types" "^25.3.0" + jest-mock "^25.3.0" + jest-util "^25.3.0" jsdom "^15.2.1" -jest-environment-node@^25.2.6: - version "25.2.6" - resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-25.2.6.tgz#ad4398432867113f474d94fe37b071ed04b30f3d" - integrity sha512-D1Ihj14fxZiMHGeTtU/LunhzSI+UeBvlr/rcXMTNyRMUMSz2PEhuqGbB78brBY6Dk3FhJDk7Ta+8reVaGjLWhA== - dependencies: - "@jest/environment" "^25.2.6" - "@jest/fake-timers" "^25.2.6" - "@jest/types" "^25.2.6" - jest-mock "^25.2.6" - jest-util "^25.2.6" +jest-environment-node@^25.3.0: + version "25.3.0" + resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-25.3.0.tgz#9845f0e63991e8498448cb0ae804935689533db9" + integrity sha512-XO09S29Nx1NU7TiMPHMoDIkxoGBuKSTbE+sHp0gXbeLDXhIdhysUI25kOqFFSD9AuDgvPvxWCXrvNqiFsOH33g== + dependencies: + "@jest/environment" "^25.3.0" + "@jest/fake-timers" "^25.3.0" + "@jest/types" "^25.3.0" + jest-mock "^25.3.0" + jest-util "^25.3.0" semver "^6.3.0" jest-get-type@^25.2.6: @@ -2523,17 +2547,17 @@ jest-get-type@^25.2.6: resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-25.2.6.tgz#0b0a32fab8908b44d508be81681487dbabb8d877" integrity sha512-DxjtyzOHjObRM+sM1knti6or+eOgcGU4xVSb2HNP1TqO4ahsT+rqZg+nyqHWJSvWgKC5cG3QjGFBqxLghiF/Ig== -jest-haste-map@^25.2.6: - version "25.2.6" - resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-25.2.6.tgz#4aa6bcfa15310afccdb9ca77af58a98add8cedb8" - integrity sha512-nom0+fnY8jwzelSDQnrqaKAcDZczYQvMEwcBjeL3PQ4MlcsqeB7dmrsAniUw/9eLkngT5DE6FhnenypilQFsgA== +jest-haste-map@^25.3.0: + version "25.3.0" + resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-25.3.0.tgz#b7683031c9c9ddc0521d311564108b244b11e4c6" + integrity sha512-LjXaRa+F8wwtSxo9G+hHD/Cp63PPQzvaBL9XCVoJD2rrcJO0Zr2+YYzAFWWYJ5GlPUkoaJFJtOuk0sL6MJY80A== dependencies: - "@jest/types" "^25.2.6" + "@jest/types" "^25.3.0" anymatch "^3.0.3" fb-watchman "^2.0.0" graceful-fs "^4.2.3" jest-serializer "^25.2.6" - jest-util "^25.2.6" + jest-util "^25.3.0" jest-worker "^25.2.6" micromatch "^4.0.2" sane "^4.0.3" @@ -2542,66 +2566,66 @@ jest-haste-map@^25.2.6: optionalDependencies: fsevents "^2.1.2" -jest-jasmine2@^25.2.7: - version "25.2.7" - resolved "https://registry.yarnpkg.com/jest-jasmine2/-/jest-jasmine2-25.2.7.tgz#55ff87f8f462ef0e2f16fd19430b8be8bcebef0e" - integrity sha512-HeQxEbonp8fUvik9jF0lkU9ab1u5TQdIb7YSU9Fj7SxWtqHNDGyCpF6ZZ3r/5yuertxi+R95Ba9eA91GMQ38eA== +jest-jasmine2@^25.3.0: + version "25.3.0" + resolved "https://registry.yarnpkg.com/jest-jasmine2/-/jest-jasmine2-25.3.0.tgz#16ae4f68adef65fb45001b26c864bcbcbf972830" + integrity sha512-NCYOGE6+HNzYFSui52SefgpsnIzvxjn6KAgqw66BdRp37xpMD/4kujDHLNW5bS5i53os5TcMn6jYrzQRO8VPrQ== dependencies: "@babel/traverse" "^7.1.0" - "@jest/environment" "^25.2.6" + "@jest/environment" "^25.3.0" "@jest/source-map" "^25.2.6" - "@jest/test-result" "^25.2.6" - "@jest/types" "^25.2.6" + "@jest/test-result" "^25.3.0" + "@jest/types" "^25.3.0" chalk "^3.0.0" co "^4.6.0" - expect "^25.2.7" + expect "^25.3.0" is-generator-fn "^2.0.0" - jest-each "^25.2.6" - jest-matcher-utils "^25.2.7" - jest-message-util "^25.2.6" - jest-runtime "^25.2.7" - jest-snapshot "^25.2.7" - jest-util "^25.2.6" - pretty-format "^25.2.6" + jest-each "^25.3.0" + jest-matcher-utils "^25.3.0" + jest-message-util "^25.3.0" + jest-runtime "^25.3.0" + jest-snapshot "^25.3.0" + jest-util "^25.3.0" + pretty-format "^25.3.0" throat "^5.0.0" -jest-leak-detector@^25.2.6: - version "25.2.6" - resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-25.2.6.tgz#68fbaf651142292b03e30641f33e15af9b8c62b1" - integrity sha512-n+aJUM+j/x1kIaPVxzerMqhAUuqTU1PL5kup46rXh+l9SP8H6LqECT/qD1GrnylE1L463/0StSPkH4fUpkuEjA== +jest-leak-detector@^25.3.0: + version "25.3.0" + resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-25.3.0.tgz#5b6bf04903b35be56038915a55f47291771f769f" + integrity sha512-jk7k24dMIfk8LUSQQGN8PyOy9+J0NAfHZWiDmUDYVMctY8FLJQ1eQ8+PjMoN8PgwhLIggUqgYJnyRFvUz3jLRw== dependencies: jest-get-type "^25.2.6" - pretty-format "^25.2.6" + pretty-format "^25.3.0" -jest-matcher-utils@^25.2.7: - version "25.2.7" - resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-25.2.7.tgz#53fad3c11fc42e92e374306df543026712c957a3" - integrity sha512-jNYmKQPRyPO3ny0KY1I4f0XW4XnpJ3Nx5ovT4ik0TYDOYzuXJW40axqOyS61l/voWbVT9y9nZ1THL1DlpaBVpA== +jest-matcher-utils@^25.3.0: + version "25.3.0" + resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-25.3.0.tgz#76765788a26edaa8bc5f0100aea52ae383559648" + integrity sha512-ZBUJ2fchNIZt+fyzkuCFBb8SKaU//Rln45augfUtbHaGyVxCO++ANARdBK9oPGXU3hEDgyy7UHnOP/qNOJXFUg== dependencies: chalk "^3.0.0" - jest-diff "^25.2.6" + jest-diff "^25.3.0" jest-get-type "^25.2.6" - pretty-format "^25.2.6" + pretty-format "^25.3.0" -jest-message-util@^25.2.6: - version "25.2.6" - resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-25.2.6.tgz#9d5523bebec8cd9cdef75f0f3069d6ec9a2252df" - integrity sha512-Hgg5HbOssSqOuj+xU1mi7m3Ti2nwSQJQf/kxEkrz2r2rp2ZLO1pMeKkz2WiDUWgSR+APstqz0uMFcE5yc0qdcg== +jest-message-util@^25.3.0: + version "25.3.0" + resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-25.3.0.tgz#e3836826fe5ca538a337b87d9bd2648190867f85" + integrity sha512-5QNy9Id4WxJbRITEbA1T1kem9bk7y2fD0updZMSTNHtbEDnYOGLDPAuFBhFgVmOZpv0n6OMdVkK+WhyXEPCcOw== dependencies: "@babel/code-frame" "^7.0.0" - "@jest/types" "^25.2.6" + "@jest/types" "^25.3.0" "@types/stack-utils" "^1.0.1" chalk "^3.0.0" micromatch "^4.0.2" slash "^3.0.0" stack-utils "^1.0.1" -jest-mock@^25.2.6: - version "25.2.6" - resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-25.2.6.tgz#8df66eaa55a713d0f2a7dfb4f14507289d24dfa3" - integrity sha512-vc4nibavi2RGPdj/MyZy/azuDjZhpYZLvpfgq1fxkhbyTpKVdG7CgmRVKJ7zgLpY5kuMjTzDYA6QnRwhsCU+tA== +jest-mock@^25.3.0: + version "25.3.0" + resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-25.3.0.tgz#d72644509e40987a732a9a2534a1054f4649402c" + integrity sha512-yRn6GbuqB4j3aYu+Z1ezwRiZfp0o9om5uOcBovVtkcRLeBCNP5mT0ysdenUsxAHnQUgGwPOE1wwhtQYe6NKirQ== dependencies: - "@jest/types" "^25.2.6" + "@jest/types" "^25.3.0" jest-pnp-resolver@^1.2.1: version "1.2.1" @@ -2612,78 +2636,78 @@ jest-regex-util@^25.2.6: resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-25.2.6.tgz#d847d38ba15d2118d3b06390056028d0f2fd3964" integrity sha512-KQqf7a0NrtCkYmZZzodPftn7fL1cq3GQAFVMn5Hg8uKx/fIenLEobNanUxb7abQ1sjADHBseG/2FGpsv/wr+Qw== -jest-resolve-dependencies@^25.2.7: - version "25.2.7" - resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-25.2.7.tgz#9ca4c62d67cce031a27fa5d5705b4b5b5c029d23" - integrity sha512-IrnMzCAh11Xd2gAOJL+ThEW6QO8DyqNdvNkQcaCticDrOAr9wtKT7yT6QBFFjqKFgjjvaVKDs59WdgUhgYnHnQ== +jest-resolve-dependencies@^25.3.0: + version "25.3.0" + resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-25.3.0.tgz#b0e4ae053dd44ddacc18c6ee12b5b7c28e445a90" + integrity sha512-bDUlLYmHW+f7J7KgcY2lkq8EMRqKonRl0XoD4Wp5SJkgAxKJnsaIOlrrVNTfXYf+YOu3VCjm/Ac2hPF2nfsCIA== dependencies: - "@jest/types" "^25.2.6" + "@jest/types" "^25.3.0" jest-regex-util "^25.2.6" - jest-snapshot "^25.2.7" + jest-snapshot "^25.3.0" -jest-resolve@^25.2.6: - version "25.2.6" - resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-25.2.6.tgz#84694ead5da13c2890ac04d4a78699ba937f3896" - integrity sha512-7O61GVdcAXkLz/vNGKdF+00A80/fKEAA47AEXVNcZwj75vEjPfZbXDaWFmAQCyXj4oo9y9dC9D+CLA11t8ieGw== +jest-resolve@^25.3.0: + version "25.3.0" + resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-25.3.0.tgz#cb90a5bbea54a02eccdbbf4126a819595dcf91d6" + integrity sha512-IHoQAAybulsJ+ZgWis+ekYKDAoFkVH5Nx/znpb41zRtpxj4fr2WNV9iDqavdSm8GIpMlsfZxbC/fV9DhW0q9VQ== dependencies: - "@jest/types" "^25.2.6" + "@jest/types" "^25.3.0" browser-resolve "^1.11.3" chalk "^3.0.0" jest-pnp-resolver "^1.2.1" realpath-native "^2.0.0" resolve "^1.15.1" -jest-runner@^25.2.7: - version "25.2.7" - resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-25.2.7.tgz#3676c01dc0104caa8a0ebb8507df382c88f2a1e2" - integrity sha512-RFEr71nMrtNwcpoHzie5+fe1w3JQCGMyT2xzNwKe3f88+bK+frM2o1v24gEcPxQ2QqB3COMCe2+1EkElP+qqqQ== +jest-runner@^25.3.0: + version "25.3.0" + resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-25.3.0.tgz#673ef2ac79d2810eb6b2c1a3f82398375a3d1174" + integrity sha512-csDqSC9qGHYWDrzrElzEgFbteztFeZJmKhSgY5jlCIcN0+PhActzRNku0DA1Xa1HxGOb0/AfbP1EGJlP4fGPtA== dependencies: - "@jest/console" "^25.2.6" - "@jest/environment" "^25.2.6" - "@jest/test-result" "^25.2.6" - "@jest/types" "^25.2.6" + "@jest/console" "^25.3.0" + "@jest/environment" "^25.3.0" + "@jest/test-result" "^25.3.0" + "@jest/types" "^25.3.0" chalk "^3.0.0" exit "^0.1.2" graceful-fs "^4.2.3" - jest-config "^25.2.7" - jest-docblock "^25.2.6" - jest-haste-map "^25.2.6" - jest-jasmine2 "^25.2.7" - jest-leak-detector "^25.2.6" - jest-message-util "^25.2.6" - jest-resolve "^25.2.6" - jest-runtime "^25.2.7" - jest-util "^25.2.6" + jest-config "^25.3.0" + jest-docblock "^25.3.0" + jest-haste-map "^25.3.0" + jest-jasmine2 "^25.3.0" + jest-leak-detector "^25.3.0" + jest-message-util "^25.3.0" + jest-resolve "^25.3.0" + jest-runtime "^25.3.0" + jest-util "^25.3.0" jest-worker "^25.2.6" source-map-support "^0.5.6" throat "^5.0.0" -jest-runtime@^25.2.7: - version "25.2.7" - resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-25.2.7.tgz#cb10e695d036671a83aec3a3803163c354043ac9" - integrity sha512-Gw3X8KxTTFylu2T/iDSNKRUQXQiPIYUY0b66GwVYa7W8wySkUljKhibQHSq0VhmCAN7vRBEQjlVQ+NFGNmQeBw== +jest-runtime@^25.3.0: + version "25.3.0" + resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-25.3.0.tgz#af4d40dbcc590fa5de9910cb6a120a13d131050b" + integrity sha512-gn5KYB1wxXRM3nfw8fVpthFu60vxQUCr+ShGq41+ZBFF3DRHZRKj3HDWVAVB4iTNBj2y04QeAo5cZ/boYaPg0w== dependencies: - "@jest/console" "^25.2.6" - "@jest/environment" "^25.2.6" + "@jest/console" "^25.3.0" + "@jest/environment" "^25.3.0" "@jest/source-map" "^25.2.6" - "@jest/test-result" "^25.2.6" - "@jest/transform" "^25.2.6" - "@jest/types" "^25.2.6" + "@jest/test-result" "^25.3.0" + "@jest/transform" "^25.3.0" + "@jest/types" "^25.3.0" "@types/yargs" "^15.0.0" chalk "^3.0.0" collect-v8-coverage "^1.0.0" exit "^0.1.2" glob "^7.1.3" graceful-fs "^4.2.3" - jest-config "^25.2.7" - jest-haste-map "^25.2.6" - jest-message-util "^25.2.6" - jest-mock "^25.2.6" + jest-config "^25.3.0" + jest-haste-map "^25.3.0" + jest-message-util "^25.3.0" + jest-mock "^25.3.0" jest-regex-util "^25.2.6" - jest-resolve "^25.2.6" - jest-snapshot "^25.2.7" - jest-util "^25.2.6" - jest-validate "^25.2.6" + jest-resolve "^25.3.0" + jest-snapshot "^25.3.0" + jest-util "^25.3.0" + jest-validate "^25.3.0" realpath-native "^2.0.0" slash "^3.0.0" strip-bom "^4.0.0" @@ -2694,58 +2718,58 @@ jest-serializer@^25.2.6: resolved "https://registry.yarnpkg.com/jest-serializer/-/jest-serializer-25.2.6.tgz#3bb4cc14fe0d8358489dbbefbb8a4e708ce039b7" integrity sha512-RMVCfZsezQS2Ww4kB5HJTMaMJ0asmC0BHlnobQC6yEtxiFKIxohFA4QSXSabKwSggaNkqxn6Z2VwdFCjhUWuiQ== -jest-snapshot@^25.2.7: - version "25.2.7" - resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-25.2.7.tgz#7eeafeef4dcbda1c47c8503d2bf5212b6430aac6" - integrity sha512-Rm8k7xpGM4tzmYhB6IeRjsOMkXaU8/FOz5XlU6oYwhy53mq6txVNqIKqN1VSiexzpC80oWVxVDfUDt71M6XPOA== +jest-snapshot@^25.3.0: + version "25.3.0" + resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-25.3.0.tgz#d4feb457494f4aaedcc83fbbf1ca21808fc3df71" + integrity sha512-GGpR6Oro2htJPKh5RX4PR1xwo5jCEjtvSPLW1IS7N85y+2bWKbiknHpJJRKSdGXghElb5hWaeQASJI4IiRayGg== dependencies: "@babel/types" "^7.0.0" - "@jest/types" "^25.2.6" + "@jest/types" "^25.3.0" "@types/prettier" "^1.19.0" chalk "^3.0.0" - expect "^25.2.7" - jest-diff "^25.2.6" + expect "^25.3.0" + jest-diff "^25.3.0" jest-get-type "^25.2.6" - jest-matcher-utils "^25.2.7" - jest-message-util "^25.2.6" - jest-resolve "^25.2.6" + jest-matcher-utils "^25.3.0" + jest-message-util "^25.3.0" + jest-resolve "^25.3.0" make-dir "^3.0.0" natural-compare "^1.4.0" - pretty-format "^25.2.6" + pretty-format "^25.3.0" semver "^6.3.0" -jest-util@^25.2.6: - version "25.2.6" - resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-25.2.6.tgz#3c1c95cdfd653126728b0ed861a86610e30d569c" - integrity sha512-gpXy0H5ymuQ0x2qgl1zzHg7LYHZYUmDEq6F7lhHA8M0eIwDB2WteOcCnQsohl9c/vBKZ3JF2r4EseipCZz3s4Q== +jest-util@^25.3.0: + version "25.3.0" + resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-25.3.0.tgz#e3b0064165818f10d78514696fd25efba82cf049" + integrity sha512-dc625P/KS/CpWTJJJxKc4bA3A6c+PJGBAqS8JTJqx4HqPoKNqXg/Ec8biL2Z1TabwK7E7Ilf0/ukSEXM1VwzNA== dependencies: - "@jest/types" "^25.2.6" + "@jest/types" "^25.3.0" chalk "^3.0.0" is-ci "^2.0.0" make-dir "^3.0.0" -jest-validate@^25.2.6: - version "25.2.6" - resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-25.2.6.tgz#ab3631fb97e242c42b09ca53127abe0b12e9125e" - integrity sha512-a4GN7hYbqQ3Rt9iHsNLFqQz7HDV7KiRPCwPgo5nqtTIWNZw7gnT8KchG+Riwh+UTSn8REjFCodGp50KX/fRNgQ== +jest-validate@^25.3.0: + version "25.3.0" + resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-25.3.0.tgz#eb95fdee0039647bcd5d4be641b21e4a142a880c" + integrity sha512-3WuXgIZ4HXUvW6gk9twFFkT9j6zUorKnF2oEY8VEsHb7x5LGvVlN3WUsbqazVKuyXwvikO2zFJ/YTySMsMje2w== dependencies: - "@jest/types" "^25.2.6" + "@jest/types" "^25.3.0" camelcase "^5.3.1" chalk "^3.0.0" jest-get-type "^25.2.6" leven "^3.1.0" - pretty-format "^25.2.6" + pretty-format "^25.3.0" -jest-watcher@^25.2.7: - version "25.2.7" - resolved "https://registry.yarnpkg.com/jest-watcher/-/jest-watcher-25.2.7.tgz#01db4332d34d14c03c9ef22255125a3b07f997bc" - integrity sha512-RdHuW+f49tahWtluTnUdZ2iPliebleROI2L/J5phYrUS6DPC9RB3SuUtqYyYhGZJsbvRSuLMIlY/cICJ+PIecw== +jest-watcher@^25.3.0: + version "25.3.0" + resolved "https://registry.yarnpkg.com/jest-watcher/-/jest-watcher-25.3.0.tgz#fd03fd5ca52f02bd3161ab177466bf1bfdd34e5c" + integrity sha512-dtFkfidFCS9Ucv8azOg2hkiY3sgJEHeTLtGFHS+jfBEE7eRtrO6+2r1BokyDkaG2FOD7485r/SgpC1MFAENfeA== dependencies: - "@jest/test-result" "^25.2.6" - "@jest/types" "^25.2.6" + "@jest/test-result" "^25.3.0" + "@jest/types" "^25.3.0" ansi-escapes "^4.2.1" chalk "^3.0.0" - jest-util "^25.2.6" + jest-util "^25.3.0" string-length "^3.1.0" jest-worker@^25.2.6: @@ -2756,14 +2780,14 @@ jest-worker@^25.2.6: merge-stream "^2.0.0" supports-color "^7.0.0" -jest@25.2.7: - version "25.2.7" - resolved "https://registry.yarnpkg.com/jest/-/jest-25.2.7.tgz#3929a5f35cdd496f7756876a206b99a94e1e09ae" - integrity sha512-XV1n/CE2McCikl4tfpCY950RytHYvxdo/wvtgmn/qwA8z1s16fuvgFL/KoPrrmkqJTaPMUlLVE58pwiaTX5TdA== +jest@25.3.0: + version "25.3.0" + resolved "https://registry.yarnpkg.com/jest/-/jest-25.3.0.tgz#7a5e59741d94b8662664c77a9f346246d6bf228b" + integrity sha512-iKd5ShQSHzFT5IL/6h5RZJhApgqXSoPxhp5HEi94v6OAw9QkF8T7X+liEU2eEHJ1eMFYTHmeWLrpBWulsDpaUg== dependencies: - "@jest/core" "^25.2.7" + "@jest/core" "^25.3.0" import-local "^3.0.2" - jest-cli "^25.2.7" + jest-cli "^25.3.0" "js-tokens@^3.0.0 || ^4.0.0", js-tokens@^4.0.0: version "4.0.0" @@ -3345,12 +3369,12 @@ prelude-ls@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" -pretty-format@^25.2.6: - version "25.2.6" - resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-25.2.6.tgz#542a1c418d019bbf1cca2e3620443bc1323cb8d7" - integrity sha512-DEiWxLBaCHneffrIT4B+TpMvkV9RNvvJrd3lY9ew1CEQobDzEXmYT1mg0hJhljZty7kCc10z13ohOFAE8jrUDg== +pretty-format@^25.3.0: + version "25.3.0" + resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-25.3.0.tgz#d0a4f988ff4a6cd350342fdabbb809aeb4d49ad5" + integrity sha512-wToHwF8bkQknIcFkBqNfKu4+UZqnrLn/Vr+wwKQwwvPzkBfDDKp/qIabFqdgtoi5PEnM8LFByVsOrHoa3SpTVA== dependencies: - "@jest/types" "^25.2.6" + "@jest/types" "^25.3.0" ansi-regex "^5.0.0" ansi-styles "^4.0.0" react-is "^16.12.0" @@ -3976,10 +4000,10 @@ trim-right@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/trim-right/-/trim-right-1.0.1.tgz#cb2e1203067e0c8de1f614094b9fe45704ea6003" -ts-loader@6.2.2: - version "6.2.2" - resolved "https://registry.yarnpkg.com/ts-loader/-/ts-loader-6.2.2.tgz#dffa3879b01a1a1e0a4b85e2b8421dc0dfff1c58" - integrity sha512-HDo5kXZCBml3EUPcc7RlZOV/JGlLHwppTLEHb3SHnr5V7NXD4klMEkrhJe5wgRbaWsSXi+Y1SIBN/K9B6zWGWQ== +ts-loader@7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/ts-loader/-/ts-loader-7.0.0.tgz#7c74dfa8956e3e33b91d98d4ed7b6f7575c35c25" + integrity sha512-qq9iPK235Xf/uPS1I72CIwB8qpbW0rys3entnXO+rIo2km50lMmeHKCNn1m047W6Sk4kceF6n5NWEnq/V8xdYQ== dependencies: chalk "^2.3.0" enhanced-resolve "^4.0.0"