X-Git-Url: https://git.squeep.com/?a=blobdiff_plain;f=test%2Flib%2Frouter.js;fp=test%2Flib%2Frouter.js;h=c89cc196472a1cb6d1959126a572afb3f7789aa6;hb=a90b9c1b279773c225560aa3ae5f5f21424ec420;hp=d63917087d1490021d5441564669008c60f1676c;hpb=3b15b5ff792fc5d61be8337989058c297460cd99;p=squeep-api-dingus diff --git a/test/lib/router.js b/test/lib/router.js index d639170..c89cc19 100644 --- a/test/lib/router.js +++ b/test/lib/router.js @@ -46,6 +46,13 @@ describe('Router', function () { const r = router._pathToRoutePath(p); assert.deepStrictEqual(r, expected); }); + it('defines a path with escaped parameter', function () { + const p = '/a/\\:b/c'; + const expected = ['', 'a', ':b', 'c']; + expected[Router.kPathMethods] = {}; + const r = router._pathToRoutePath(p); + assert.deepStrictEqual(r, expected); + }); }); // _pathToRoutePath describe('_pathCompareExact', function () { @@ -291,6 +298,7 @@ describe('Router', function () { const { handler } = router.lookup(method, path, ctx); assert.strictEqual(handler, stubHandler); + assert.strictEqual(ctx.matchedPath, urlPath); }); it('does not find handler with trailing slash', function () { router.ignoreTrailingSlash = false;