@@ -8,71 +8,71 @@ describe("parseQueryParams()", () => {
88 it ( "should match /?a=1&b=2 URL" , ( ) => {
99 req . url = "/?a=1&b=2" ;
1010 const matchingRouteRule = { route : "/" } ;
11- const { matchingRewriteRoutePath , matchingRewriteRoute } = parseQueryParams ( req , matchingRouteRule ) ;
11+ const { urlPathnameWithoutQueryParams , urlPathnameWithQueryParams } = parseQueryParams ( req , matchingRouteRule ) ;
1212
13- expect ( matchingRewriteRoutePath ) . toBe ( "/" ) ;
14- expect ( matchingRewriteRoute ) . toBe ( req . url ) ;
13+ expect ( urlPathnameWithoutQueryParams ) . toBe ( "/" ) ;
14+ expect ( urlPathnameWithQueryParams ) . toBe ( req . url ) ;
1515 } ) ;
1616
1717 it ( "should match /index.html?a=1&b=2 URL" , ( ) => {
1818 req . url = "/index.html?a=1&b=2" ;
1919 const matchingRouteRule = { route : "/" } ;
20- const { matchingRewriteRoutePath , matchingRewriteRoute } = parseQueryParams ( req , matchingRouteRule ) ;
20+ const { urlPathnameWithoutQueryParams , urlPathnameWithQueryParams } = parseQueryParams ( req , matchingRouteRule ) ;
2121
22- expect ( matchingRewriteRoutePath ) . toBe ( "/index.html" ) ;
23- expect ( matchingRewriteRoute ) . toBe ( req . url ) ;
22+ expect ( urlPathnameWithoutQueryParams ) . toBe ( "/index.html" ) ;
23+ expect ( urlPathnameWithQueryParams ) . toBe ( req . url ) ;
2424 } ) ;
2525
2626 it ( "should match /foo/bar/index.html?a=1&b=2 URL" , ( ) => {
2727 req . url = "/foo/bar/index.html?a=1&b=2" ;
2828 const matchingRouteRule = { route : "/" } ;
29- const { matchingRewriteRoutePath , matchingRewriteRoute } = parseQueryParams ( req , matchingRouteRule ) ;
29+ const { urlPathnameWithoutQueryParams , urlPathnameWithQueryParams } = parseQueryParams ( req , matchingRouteRule ) ;
3030
31- expect ( matchingRewriteRoutePath ) . toBe ( "/foo/bar/index.html" ) ;
32- expect ( matchingRewriteRoute ) . toBe ( req . url ) ;
31+ expect ( urlPathnameWithoutQueryParams ) . toBe ( "/foo/bar/index.html" ) ;
32+ expect ( urlPathnameWithQueryParams ) . toBe ( req . url ) ;
3333 } ) ;
3434
3535 it ( "should match /foo/bar/?a=1&b=2 URL" , ( ) => {
3636 req . url = "/foo/bar/?a=1&b=2" ;
3737 const matchingRouteRule = { route : "/" } ;
38- const { matchingRewriteRoutePath , matchingRewriteRoute } = parseQueryParams ( req , matchingRouteRule ) ;
38+ const { urlPathnameWithoutQueryParams , urlPathnameWithQueryParams } = parseQueryParams ( req , matchingRouteRule ) ;
3939
40- expect ( matchingRewriteRoutePath ) . toBe ( "/foo/bar/" ) ;
41- expect ( matchingRewriteRoute ) . toBe ( req . url ) ;
40+ expect ( urlPathnameWithoutQueryParams ) . toBe ( "/foo/bar/" ) ;
41+ expect ( urlPathnameWithQueryParams ) . toBe ( req . url ) ;
4242 } ) ;
4343 } ) ;
4444
4545 describe ( "with rewrite rule enabled" , ( ) => {
4646 it ( "should match /?a=1&b=2 URL" , ( ) => {
4747 const matchingRouteRule = { route : "/" , rewrite : "/?a=1&b=2" } ;
48- const { matchingRewriteRoutePath , matchingRewriteRoute } = parseQueryParams ( req , matchingRouteRule ) ;
48+ const { urlPathnameWithoutQueryParams , urlPathnameWithQueryParams } = parseQueryParams ( req , matchingRouteRule ) ;
4949
50- expect ( matchingRewriteRoutePath ) . toBe ( "/" ) ;
51- expect ( matchingRewriteRoute ) . toBe ( matchingRouteRule . rewrite ) ;
50+ expect ( urlPathnameWithoutQueryParams ) . toBe ( "/" ) ;
51+ expect ( urlPathnameWithQueryParams ) . toBe ( matchingRouteRule . rewrite ) ;
5252 } ) ;
5353
5454 it ( "should match /index.html?a=1&b=2 URL" , ( ) => {
5555 const matchingRouteRule = { route : "/" , rewrite : "/index.html?a=1&b=2" } ;
56- const { matchingRewriteRoutePath , matchingRewriteRoute } = parseQueryParams ( req , matchingRouteRule ) ;
56+ const { urlPathnameWithoutQueryParams , urlPathnameWithQueryParams } = parseQueryParams ( req , matchingRouteRule ) ;
5757
58- expect ( matchingRewriteRoutePath ) . toBe ( "/index.html" ) ;
59- expect ( matchingRewriteRoute ) . toBe ( matchingRouteRule . rewrite ) ;
58+ expect ( urlPathnameWithoutQueryParams ) . toBe ( "/index.html" ) ;
59+ expect ( urlPathnameWithQueryParams ) . toBe ( matchingRouteRule . rewrite ) ;
6060 } ) ;
6161
6262 it ( "should match /foo/bar/index.html?a=1&b=2 URL" , ( ) => {
6363 const matchingRouteRule = { route : "/" , rewrite : "/foo/bar/index.html?a=1&b=2" } ;
64- const { matchingRewriteRoutePath , matchingRewriteRoute } = parseQueryParams ( req , matchingRouteRule ) ;
64+ const { urlPathnameWithoutQueryParams , urlPathnameWithQueryParams } = parseQueryParams ( req , matchingRouteRule ) ;
6565
66- expect ( matchingRewriteRoutePath ) . toBe ( "/foo/bar/index.html" ) ;
67- expect ( matchingRewriteRoute ) . toBe ( matchingRouteRule . rewrite ) ;
66+ expect ( urlPathnameWithoutQueryParams ) . toBe ( "/foo/bar/index.html" ) ;
67+ expect ( urlPathnameWithQueryParams ) . toBe ( matchingRouteRule . rewrite ) ;
6868 } ) ;
6969
7070 it ( "should match /foo/bar/?a=1&b=2 URL" , ( ) => {
7171 const matchingRouteRule = { route : "/" , rewrite : "/foo/bar/?a=1&b=2" } ;
72- const { matchingRewriteRoutePath , matchingRewriteRoute } = parseQueryParams ( req , matchingRouteRule ) ;
72+ const { urlPathnameWithoutQueryParams , urlPathnameWithQueryParams } = parseQueryParams ( req , matchingRouteRule ) ;
7373
74- expect ( matchingRewriteRoutePath ) . toBe ( "/foo/bar/" ) ;
75- expect ( matchingRewriteRoute ) . toBe ( matchingRouteRule . rewrite ) ;
74+ expect ( urlPathnameWithoutQueryParams ) . toBe ( "/foo/bar/" ) ;
75+ expect ( urlPathnameWithQueryParams ) . toBe ( matchingRouteRule . rewrite ) ;
7676 } ) ;
7777 } ) ;
7878} ) ;
0 commit comments