-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Testing): Add unit tests with Mocha
- Loading branch information
Stanislav Mikhaylov
authored
Apr 2, 2018
1 parent
2498fbb
commit e68659e
Showing
9 changed files
with
3,176 additions
and
154 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
{ | ||
"presets": [ | ||
["es2015", { "modules": false }] | ||
["env", { "modules": false }] | ||
], | ||
"plugins": [ | ||
"external-helpers" | ||
// "external-helpers" | ||
] | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"testEnvironment": "node" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
'use strict'; | ||
|
||
var _vueE = require('./vue-e164.js'); | ||
|
||
var assert = require('assert'); | ||
|
||
var tests = [{ | ||
plus: true, | ||
brackets: true, | ||
space: true, | ||
answer: '+7 (999) 975 70 65', | ||
pattern: '+ () _' | ||
}, { | ||
plus: false, | ||
brackets: false, | ||
space: false, | ||
answer: '79999757065', | ||
pattern: 'all options false' | ||
}, { | ||
plus: true, | ||
brackets: false, | ||
space: false, | ||
answer: '+79999757065', | ||
pattern: '+' | ||
}, { | ||
plus: true, | ||
brackets: true, | ||
space: false, | ||
answer: '+7(999)9757065', | ||
pattern: '+ ()' | ||
}, { | ||
plus: false, | ||
brackets: true, | ||
space: true, | ||
answer: '7 (999) 975 70 65', | ||
pattern: '() _' | ||
}, { | ||
plus: false, | ||
brackets: false, | ||
space: true, | ||
answer: '7 999 975 70 65', | ||
pattern: '_' | ||
}, { | ||
plus: false, | ||
brackets: true, | ||
space: false, | ||
answer: '7(999)9757065', | ||
pattern: '()' | ||
}, { | ||
plus: true, | ||
brackets: false, | ||
space: true, | ||
answer: '+7 999 975 70 65', | ||
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); | ||
}); | ||
}); | ||
it('Should return empty string for empty string', function () { | ||
assert.equal((0, _vueE.filter)('', { | ||
plus: true, | ||
brackets: false, | ||
space: true | ||
}), ''); | ||
}); | ||
}); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.