Skip to content
Permalink
Browse files

added url uniqeness test

  • Loading branch information...
nquinlan committed Dec 29, 2013
1 parent c625ef1 commit 1a204b1cf461b817e4c9b8f58de1293cbf487707
Showing with 14 additions and 0 deletions.
  1. +14 −0 tests/validate.js
@@ -67,11 +67,13 @@ describe('Sites', function () {
describe('Uniqueness', function () {
var ids = [];
var shortcuts = [];
var urls = [];

sites.forEach(function (site) {
if(site.object){
ids.push(site.object.id);
shortcuts = shortcuts.concat(site.object.shortcuts);
urls.push(site.object.url);
}else{
console.log(site.name);
}
@@ -102,5 +104,17 @@ describe('Sites', function () {
});
});
});

describe('url should be unique', function () {
sites.forEach(function (site) {
it(site.name + ' should be have a unique url (' + site.object.url + ')', function () {
var matches = urls.filter(function (url) {
return (url === site.object.url);
});

assert.equal(matches.length, 1, "only one object with the url");
});
});
});
});
});

0 comments on commit 1a204b1

Please sign in to comment.
You can’t perform that action at this time.