Browse Source

Add non match tests

pull/1/merge
Luke Childs 9 years ago
parent
commit
00e9a1d706
  1. 18
      test/non-matches.json
  2. 11
      test/unit.js

18
test/non-matches.json

@ -0,0 +1,18 @@
[
{
"description": "Dot seperated string without a valid TLD",
"url": "url.notatld"
},
{
"description": "Url with extra chars after a valid TLD",
"url": "url.comextra"
},
{
"description": "Url without dot",
"url": "urlcom"
},
{
"description": "Url with semicolon but no port number",
"url": "url.come:"
}
]

11
test/unit.js

@ -5,6 +5,7 @@ var Parser = require('../dist/parser');
var regex = require('../dist/regex');
var matches = require('./matches.json');
var nonMatches = require('./non-matches.json');
describe('Urls()', function() {
@ -37,4 +38,14 @@ describe('Urls()', function() {
});
describe('Should not match', function() {
nonMatches.forEach(function(nonMatch) {
it(nonMatch.description, function () {
expect(Urls(nonMatch.url).get()).to.deep.equal([]);
});
});
});
});

Loading…
Cancel
Save