@@ -7,6 +7,26 @@ describe("ClientRequest", () => {
77 clientRequest = new ClientRequest ( "/" ) ;
88 } ) ;
99
10+ it ( "removes fragment identifiers from the url" , ( done ) => {
11+ clientRequest = new ClientRequest ( "/" ) ;
12+ expect ( clientRequest . getUrl ( ) ) . toEqual ( "/" ) ;
13+ clientRequest = new ClientRequest ( "/react-server/foo#bar" ) ;
14+ expect ( clientRequest . getUrl ( ) ) . toEqual ( "/react-server/foo" ) ;
15+ clientRequest = new ClientRequest ( "/react-server/foo/#bar#bazz" ) ;
16+ expect ( clientRequest . getUrl ( ) ) . toEqual ( "/react-server/foo/" ) ;
17+ clientRequest = new ClientRequest ( "/react-server/foo/?#bar" ) ;
18+ expect ( clientRequest . getUrl ( ) ) . toEqual ( "/react-server/foo/?" ) ;
19+ clientRequest = new ClientRequest ( "/react-server/foo/?foo=bar&baz=123" ) ;
20+ expect ( clientRequest . getUrl ( ) ) . toEqual ( "/react-server/foo/?foo=bar&baz=123" ) ;
21+ clientRequest = new ClientRequest ( "/react-server/foo/?foo=bar&baz=123#" ) ;
22+ expect ( clientRequest . getUrl ( ) ) . toEqual ( "/react-server/foo/?foo=bar&baz=123" ) ;
23+ clientRequest = new ClientRequest ( "/react-server/foo/?foo=bar&baz=123&zed=abc?#some-fragment?#" ) ;
24+ expect ( clientRequest . getUrl ( ) ) . toEqual ( "/react-server/foo/?foo=bar&baz=123&zed=abc?" ) ;
25+ clientRequest = new ClientRequest ( "/react-server/foo#?bar=3&foo=7" ) ;
26+ expect ( clientRequest . getUrl ( ) ) . toEqual ( "/react-server/foo" ) ;
27+ done ( ) ;
28+ } ) ;
29+
1030 it ( "parses query params correctly" , ( done ) => {
1131 clientRequest = new ClientRequest ( "/" ) ;
1232 expect ( clientRequest . getQuery ( ) ) . toEqual ( { } ) ;
@@ -24,6 +44,8 @@ describe("ClientRequest", () => {
2444 expect ( clientRequest . getQuery ( ) ) . toEqual ( { foo : "bar" , baz : "123" } ) ;
2545 clientRequest = new ClientRequest ( "/react-server/foo/?foo=bar&baz=123&zed=abc?#some-fragment?#" ) ;
2646 expect ( clientRequest . getQuery ( ) ) . toEqual ( { foo : "bar" , baz : "123" , zed : "abc?" } ) ;
47+ clientRequest = new ClientRequest ( "/react-server/foo#?bar=3&foo=7" ) ;
48+ expect ( clientRequest . getQuery ( ) ) . toEqual ( { } ) ;
2749 done ( ) ;
2850 } ) ;
2951
0 commit comments