Skip to content

Commit

Permalink
More setup re balderdashy#3402
Browse files Browse the repository at this point in the history
  • Loading branch information
mikermcneil authored and lennym committed Feb 25, 2016
1 parent ef4e966 commit 6e568ac
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
3 changes: 3 additions & 0 deletions lib/app/get-route-for.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ var _ = require('lodash');
*/
module.exports = function getRouteFor(routeQuery){

// Get reference to sails app instance.
var sails = this;

// Validate and normalize usage.
var routeTargetToLookup;
if ( _.isString(routeQuery) ) {
Expand Down
11 changes: 10 additions & 1 deletion test/unit/app.getRouteFor.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ describe.skip('app.getRouteFor()', function (){
routes: {
'get /signup': 'PageController.signup',
'post /signup': 'UserController.signup',
'post /*': 'UserController.signup'
'post /*': 'UserController.signup',
'get /': { controller: 'PageController', action: 'homepage' },
'get /about': { target: 'PageController.about' },
'get /admin': { target: 'PageController.adminDashboard' },
'get /badmin': { target: 'PageController.admndashboard' },
}
}, done);
});
Expand All @@ -42,5 +46,10 @@ describe.skip('app.getRouteFor()', function (){
assert.equal(route.url, '/signup');
});

// TODO: if target to search for not specified or is invalid, should throw usage error (i.e. `e.code==='E_USAGE'`)
// TODO: if specified target string to search for has no dot, should throw usage error (i.e. `e.code==='E_USAGE'`)
// TODO: Should be able to match different syntaxes (routes that specify separate controller+action, or specifically specify a target)
// TODO: test case-sensitivity in action names

});

0 comments on commit 6e568ac

Please sign in to comment.