Skip to content

Commit

Permalink
Correct page type resolver logic
Browse files Browse the repository at this point in the history
  • Loading branch information
markdalgleish committed Sep 18, 2012
1 parent a0c624d commit dbd9b7c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/urlresolver.js
Expand Up @@ -12,7 +12,7 @@ var shortenUrl = function(url) {
};

var resolvePageType = function(url, types) {
url = resolveUrl(url);
url = shortenUrl(url);
types = types || standardPageTypes;

var matches = Object.keys(types).filter(function(type) {
Expand Down
4 changes: 3 additions & 1 deletion test/urlresolver_test.js
Expand Up @@ -28,7 +28,9 @@ exports['shortenUrl'] = {

exports['resolvePageType'] = {
'returns the correct page type': function(test) {
test.equals(resolver.resolvePageType('/foobar', { foo: /foo/ } ), 'foo');
test.equals(resolver.resolvePageType('2012/melbjs-september'), 'event');
test.equals(resolver.resolvePageType('series/melbjs'), 'series');
test.equals(resolver.resolvePageType('foobar', { foo: /foo/ } ), 'foo');
test.done();
}
};

0 comments on commit dbd9b7c

Please sign in to comment.