Permalink
Browse files

Updated tests to check multiple URL arguments.

  • Loading branch information...
1 parent 7921542 commit adea16447198707e84f048fa97ac6e983f3f68ed @cskr committed Dec 31, 2010
Showing with 9 additions and 7 deletions.
  1. +5 −3 test/simple/dispatcher-test.js
  2. +2 −2 test/system/dispatch/test-routes.js
  3. +2 −2 test/system/dispatch/test.js
@@ -13,9 +13,11 @@ suite.tests = {
next();
},
- 'GET with in-path argument.': function(next) {
- invoke('GET', '/path/ABC', {}, undefined, '/path/{id}', function(args) {
- assert.equal(args.id, 'ABC');
+ 'GET with in-path arguments.': function(next) {
+ invoke('GET', '/path/1/ABC', {}, undefined, '/path/{id}/{name}',
+ function(args) {
+ assert.equal(args.id, '1');
+ assert.equal(args.name, 'ABC');
});
next();
},
@@ -13,8 +13,8 @@ gh.get('/', function() {
this.renderText(this.params['name']);
});
-gh.get('/args_supported/{name}', function(args) {
- this.renderText(args['name']);
+gh.get('/args_supported/{id}/{name}', function(args) {
+ this.renderText(args['id'] + ' ' + args['name']);
});
gh.get('/templated/{name}', function(args) {
@@ -26,9 +26,9 @@ suite.tests = {
},
'GET with URL argument.': function(next) {
- testUtil.invoke('GET', '/args_supported/Chandru', {}, function(res) {
+ testUtil.invoke('GET', '/args_supported/1/Chandru', {}, function(res) {
res.on('data', function(chunk) {
- assert.equal(chunk, 'Chandru');
+ assert.equal(chunk, '1 Chandru');
next();
});
});

0 comments on commit adea164

Please sign in to comment.