Skip to content

Commit

Permalink
tests: add test for unnamed capture group regexp
Browse files Browse the repository at this point in the history
  • Loading branch information
dougwilson committed Jul 21, 2022
1 parent efd112a commit 7ddcab5
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions test/route.js
Expand Up @@ -859,6 +859,25 @@ describe('Router', function () {
.expect(200, { foo: '42' }, cb)
})
})

describe('using "(regexp)"', function () {
it('should add capture group using regexp', function (done) {
var cb = after(2, done)
var router = new Router()
var route = router.route('/page_([0-9]+)')
var server = createServer(router)

route.all(sendParams)

request(server)
.get('/page_foo')
.expect(404, cb)

request(server)
.get('/page_42')
.expect(200, { 0: '42' }, cb)
})
})
})
})
})
Expand Down

0 comments on commit 7ddcab5

Please sign in to comment.