Skip to content
This repository has been archived by the owner on Sep 24, 2022. It is now read-only.

Commit

Permalink
added url uniqeness test
Browse files Browse the repository at this point in the history
  • Loading branch information
nquinlan committed Dec 29, 2013
1 parent c625ef1 commit 1a204b1
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/validate.js
Expand Up @@ -67,11 +67,13 @@ describe('Sites', function () {
describe('Uniqueness', function () { describe('Uniqueness', function () {
var ids = []; var ids = [];
var shortcuts = []; var shortcuts = [];
var urls = [];


sites.forEach(function (site) { sites.forEach(function (site) {
if(site.object){ if(site.object){
ids.push(site.object.id); ids.push(site.object.id);
shortcuts = shortcuts.concat(site.object.shortcuts); shortcuts = shortcuts.concat(site.object.shortcuts);
urls.push(site.object.url);
}else{ }else{
console.log(site.name); console.log(site.name);
} }
Expand Down Expand Up @@ -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.