@@ -723,72 +723,74 @@ describe('encoding: URL path segment', () => {
723723 it . each ( [
724724 {
725725 input : '/path-segment/%C3%A9' ,
726- output : '/path-segment/é ' ,
726+ output : '/path-segment/%25C3%25A9 ' ,
727727 type : 'encoded' ,
728728 } ,
729729 {
730730 input : '/path-segment/é' ,
731- output : '/path-segment/é ' ,
732- type : 'not encoded' ,
731+ output : '/path-segment/%C3%A9 ' ,
732+ type : 'encoded' ,
733733 } ,
734734 {
735- input : '/path-segment/100%25' , // `%25` = `%`
736- output : '/path-segment/100%25 ' ,
737- type : 'not encoded' ,
735+ input : '/path-segment/100%25' ,
736+ output : '/path-segment/100%2525 ' ,
737+ type : 'encoded' ,
738738 } ,
739739 {
740740 input : '/path-segment/100%25%25' ,
741- output : '/path-segment/100%25%25 ' ,
742- type : 'not encoded' ,
741+ output : '/path-segment/100%2525%2525 ' ,
742+ type : 'encoded' ,
743743 } ,
744744 {
745- input : '/path-segment/100%26' , // `%26` = `&`
746- output : '/path-segment/100%26 ' ,
747- type : 'not encoded' ,
745+ input : '/path-segment/100%26' ,
746+ output : '/path-segment/100%2526 ' ,
747+ type : 'encoded' ,
748748 } ,
749749 {
750750 input : '/path-segment/%F0%9F%9A%80' ,
751- output : '/path-segment/🚀 ' ,
751+ output : '/path-segment/%25F0%259F%259A%2580 ' ,
752752 type : 'encoded' ,
753753 } ,
754754 {
755755 input : '/path-segment/%F0%9F%9A%80to%2Fthe%2Fmoon' ,
756- output : '/path-segment/🚀to%2Fthe%2Fmoon ' ,
756+ output : '/path-segment/%25F0%259F%259A%2580to%252Fthe%252Fmoon ' ,
757757 type : 'encoded' ,
758758 } ,
759759 {
760760 input : '/path-segment/%25%F0%9F%9A%80to%2Fthe%2Fmoon' ,
761- output : '/path-segment/%25🚀to%2Fthe%2Fmoon ' ,
761+ output : '/path-segment/%2525%25F0%259F%259A%2580to%252Fthe%252Fmoon ' ,
762762 type : 'encoded' ,
763763 } ,
764764 {
765765 input : '/path-segment/%F0%9F%9A%80to%2Fthe%2Fmoon%25' ,
766- output : '/path-segment/🚀to%2Fthe%2Fmoon%25 ' ,
766+ output : '/path-segment/%25F0%259F%259A%2580to%252Fthe%252Fmoon%2525 ' ,
767767 type : 'encoded' ,
768768 } ,
769769 {
770770 input :
771771 '/path-segment/%F0%9F%9A%80to%2Fthe%2Fmoon%25%F0%9F%9A%80to%2Fthe%2Fmoon' ,
772- output : '/path-segment/🚀to%2Fthe%2Fmoon%25🚀to%2Fthe%2Fmoon' ,
772+ output :
773+ '/path-segment/%25F0%259F%259A%2580to%252Fthe%252Fmoon%2525%25F0%259F%259A%2580to%252Fthe%252Fmoon' ,
773774 type : 'encoded' ,
774775 } ,
775776 {
776777 input : '/path-segment/🚀' ,
777- output : '/path-segment/🚀 ' ,
778- type : 'not encoded' ,
778+ output : '/path-segment/%F0%9F%9A%80 ' ,
779+ type : 'encoded' ,
779780 } ,
780781 {
781782 input : '/path-segment/🚀to%2Fthe%2Fmoon' ,
782- output : '/path-segment/🚀to%2Fthe%2Fmoon ' ,
783- type : 'not encoded' ,
783+ output : '/path-segment/%F0%9F%9A%80to%252Fthe%252Fmoon ' ,
784+ type : 'encoded' ,
784785 } ,
785786 ] ) (
786787 'should resolve $input to $output when the path segment is $type' ,
787788 async ( { input, output } ) => {
788789 const { router } = createTestRouter ( {
789- history : createMemoryHistory ( { initialEntries : [ input ] } ) ,
790+ history : createMemoryHistory ( {
791+ initialEntries : [ input . split ( '/' ) . map ( encodeURIComponent ) . join ( '/' ) ] , // In browser, the path is encoded by default
792+ } ) ,
790793 } )
791-
792794 render ( < RouterProvider router = { router } /> )
793795 await act ( ( ) => router . load ( ) )
794796
0 commit comments