Merge branch 'v1.2-dev' as v1.2.10
[squeep-api-dingus] / test / lib / router.js
index d63917087d1490021d5441564669008c60f1676c..c89cc196472a1cb6d1959126a572afb3f7789aa6 100644 (file)
@@ -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;