Skip to content
This repository has been archived by the owner on Dec 30, 2018. It is now read-only.

Commit

Permalink
appended test
Browse files Browse the repository at this point in the history
  • Loading branch information
sasaplus1 committed Nov 24, 2013
1 parent b10f335 commit 949b744
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
6 changes: 6 additions & 0 deletions test/test-router.js
Expand Up @@ -65,6 +65,12 @@ describe('Router', function() {
.get('/', function(req, res, next) {})
.route({ method: 'GET', url: '/' }, {})
).to.be(true);

expect(
route
.get({ path: '/', callback: function(req, res, next) {} })
.route({ method: 'GET', url: '/' }, {})
).to.be(true);
});

it('should be return true if matching route has empty path', function() {
Expand Down
27 changes: 27 additions & 0 deletions test/test-routes.js
Expand Up @@ -82,6 +82,33 @@ describe('Routes', function() {
]);
});

it('should be append route (path is object)', function() {
route.append({path: '/route1', callback: route1});
route.append({path: '/route2', callback: route2});
route.append({path: '/route3', callback: route3});

expect(route.routes_).to.eql([
{
path: '/route1',
callback: route1,
paramKeys: undefined,
isRegExp: false
},
{
path: '/route2',
callback: route2,
paramKeys: undefined,
isRegExp: false
},
{
path: '/route3',
callback: route3,
paramKeys: undefined,
isRegExp: false
}
]);
});

it('should be append route (path has placeholder)', function() {
route.append('/:key1/:param1', route1);
route.append('/:key2/:param2', route2);
Expand Down

0 comments on commit 949b744

Please sign in to comment.