diff --git a/dist/test.js b/dist/test.js index fdc79c9..89508d6 100644 --- a/dist/test.js +++ b/dist/test.js @@ -97,10 +97,16 @@ var tests = [{ pattern: '+ _ -' }]; -describe('Using different options', function () { - tests.forEach(function (item) { - it('Should return value in correct pattern: ' + item.pattern, function () { - assert.equal((0, _vueE.filter)('79999757065', item), item.answer); +var testPhones = ['79999757065', '7-999-975-7065', '7-999-975-70-65', '7-(999)-975-70-65', '7(999)975-70-65', '7 999 975 70 65', '7 (999) 975 70 65', '+79999757065', '+7-999-975-7065', '+7-999-975-70-65', '+7-(999)-975-70-65', '+7(999)975-70-65', '+7 999 975 70 65', '7 (999) 975 70 65']; + +testPhones.forEach(function (phone) { + describe('Test defferent phone numbers : ' + phone, function () { + describe('Using different options: ', function () { + tests.forEach(function (item) { + it('Should return value in correct pattern: ' + item.pattern, function () { + assert.equal((0, _vueE.filter)(phone, item), item.answer); + }); + }); }); }); it('Should return empty string for empty string', function () { diff --git a/src/test.js b/src/test.js index 60f2693..1b3d8a4 100644 --- a/src/test.js +++ b/src/test.js @@ -108,18 +108,41 @@ const tests = [ } ] -describe('Using different options', () => { - tests.forEach((item) => { - it(`Should return value in correct pattern: ${item.pattern}`, () => { - assert.equal(filter('79999757065', item), item.answer) +let testPhones = [ + '79999757065', + '7-999-975-7065', + '7-999-975-70-65', + '7-(999)-975-70-65', + '7(999)975-70-65', + '7 999 975 70 65', + '7 (999) 975 70 65', + '+79999757065', + '+7-999-975-7065', + '+7-999-975-70-65', + '+7-(999)-975-70-65', + '+7(999)975-70-65', + '+7 999 975 70 65', + '7 (999) 975 70 65' +] + +testPhones.forEach((phone) => { + describe(`Test different phone numbers : ${phone}`, () => { + describe(`Using different options: `, () => { + tests.forEach((item) => { + it(`Should return value in correct pattern: ${item.pattern}`, () => { + assert.equal(filter(phone, item), item.answer) + }) + }) + + }) + }) + it('Should return empty string for empty string', () => { + assert.equal(filter('', { + plus: true, + brackets: false, + space: true, + dash: false + }), '') }) - }) - it('Should return empty string for empty string', () => { - assert.equal(filter('', { - plus: true, - brackets: false, - space: true, - dash: false - }), '') - }) }) +