You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
998 B

9 years ago
var expect = require('chai').expect;
var Urls = require('../dist/my-name-is-url');
var Parser = require('../dist/parser');
var regex = require('../dist/regex');
var matches = require('./matches.json');
describe('Urls()', function() {
it('Should return instance of parser', function () {
expect(Urls()).to.be.an.instanceof(Parser);
});
it('Should expose regex as property', function () {
expect(Urls.regex).to.equal(regex);
});
describe('.get()', function() {
it('Should always return an array', function () {
expect(Urls().get()).to.be.instanceof(Array);
expect(Urls('').get()).to.be.instanceof(Array);
expect(Urls('no url').get()).to.be.instanceof(Array);
expect(Urls('url.com').get()).to.be.instanceof(Array);
});
});
describe('Should match', function() {
matches.forEach(function(match) {
it(match.description, function () {
expect(Urls(match.url).get()).to.deep.equal([match.url]);
});
});
});
});