one 1.1.520 → 1.1.522
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/Root.js.map +1 -1
- package/dist/cjs/Root.native.js.map +1 -1
- package/dist/cjs/cli/dev.cjs +2 -0
- package/dist/cjs/cli/dev.js +2 -0
- package/dist/cjs/cli/dev.js.map +1 -1
- package/dist/cjs/cli/dev.native.js +2 -0
- package/dist/cjs/cli/dev.native.js.map +1 -1
- package/dist/cjs/createApp.js +1 -4
- package/dist/cjs/createApp.js.map +1 -1
- package/dist/cjs/createHandleRequest.js.map +1 -1
- package/dist/cjs/createHandleRequest.native.js.map +1 -1
- package/dist/cjs/fork/__tests__/getPathFromState.test.js +88 -90
- package/dist/cjs/fork/__tests__/getPathFromState.test.js.map +1 -1
- package/dist/cjs/fork/__tests__/getPathFromState.test.native.js.map +1 -1
- package/dist/cjs/fork/__tests__/getStateFromPath.test.js +86 -163
- package/dist/cjs/fork/__tests__/getStateFromPath.test.js.map +1 -1
- package/dist/cjs/fork/__tests__/getStateFromPath.test.native.js.map +1 -1
- package/dist/cjs/fork/getPathFromState.js +6 -1
- package/dist/cjs/fork/getPathFromState.js.map +1 -1
- package/dist/cjs/fork/getPathFromState.native.js.map +1 -1
- package/dist/cjs/fork/getStateFromPath.test.js.map +1 -1
- package/dist/cjs/fork/getStateFromPath.test.native.js.map +1 -1
- package/dist/cjs/hooks.js.map +1 -1
- package/dist/cjs/hooks.native.js.map +1 -1
- package/dist/cjs/router/Route.js.map +1 -1
- package/dist/cjs/router/Route.native.js.map +1 -1
- package/dist/cjs/router/RouteInfoContext.js +1 -7
- package/dist/cjs/router/RouteInfoContext.js.map +1 -1
- package/dist/cjs/router/RouteInfoContext.native.js.map +1 -1
- package/dist/cjs/router/useViteRoutes.js.map +1 -1
- package/dist/cjs/router/useViteRoutes.native.js.map +1 -1
- package/dist/cjs/server/oneServe.js +1 -6
- package/dist/cjs/server/oneServe.js.map +1 -1
- package/dist/cjs/server/oneServe.native.js.map +1 -1
- package/dist/cjs/setup.cjs +1 -31
- package/dist/cjs/setup.js +1 -25
- package/dist/cjs/setup.js.map +1 -1
- package/dist/cjs/views/Navigator.js +8 -16
- package/dist/cjs/views/Navigator.js.map +1 -1
- package/dist/cjs/views/Navigator.native.js.map +1 -1
- package/dist/cjs/vite/one.cjs +4 -50
- package/dist/cjs/vite/one.js +5 -48
- package/dist/cjs/vite/one.js.map +1 -1
- package/dist/cjs/vite/one.native.js +3 -53
- package/dist/cjs/vite/one.native.js.map +2 -2
- package/dist/cjs/vite/plugins/clientTreeShakePlugin.js +8 -2
- package/dist/cjs/vite/plugins/clientTreeShakePlugin.js.map +1 -1
- package/dist/cjs/vite/plugins/clientTreeShakePlugin.native.js.map +1 -1
- package/dist/cjs/vite/plugins/generateFileSystemRouteTypesPlugin.js +3 -1
- package/dist/cjs/vite/plugins/generateFileSystemRouteTypesPlugin.js.map +1 -1
- package/dist/cjs/vite/plugins/generateFileSystemRouteTypesPlugin.native.js.map +1 -1
- package/dist/cjs/vite/types.native.js.map +1 -1
- package/dist/esm/Root.js.map +1 -1
- package/dist/esm/Root.mjs.map +1 -1
- package/dist/esm/Root.native.js.map +1 -1
- package/dist/esm/cli/dev.js +2 -0
- package/dist/esm/cli/dev.js.map +1 -1
- package/dist/esm/cli/dev.mjs +2 -0
- package/dist/esm/cli/dev.mjs.map +1 -1
- package/dist/esm/cli/dev.native.js +2 -0
- package/dist/esm/cli/dev.native.js.map +1 -1
- package/dist/esm/createApp.js +1 -4
- package/dist/esm/createApp.js.map +1 -1
- package/dist/esm/createApp.mjs.map +1 -1
- package/dist/esm/createHandleRequest.js.map +1 -1
- package/dist/esm/createHandleRequest.mjs.map +1 -1
- package/dist/esm/createHandleRequest.native.js.map +1 -1
- package/dist/esm/fork/__tests__/getPathFromState.test.js +88 -90
- package/dist/esm/fork/__tests__/getPathFromState.test.js.map +1 -1
- package/dist/esm/fork/__tests__/getPathFromState.test.mjs.map +1 -1
- package/dist/esm/fork/__tests__/getPathFromState.test.native.js.map +1 -1
- package/dist/esm/fork/__tests__/getStateFromPath.test.js +86 -163
- package/dist/esm/fork/__tests__/getStateFromPath.test.js.map +1 -1
- package/dist/esm/fork/__tests__/getStateFromPath.test.mjs.map +1 -1
- package/dist/esm/fork/__tests__/getStateFromPath.test.native.js.map +1 -1
- package/dist/esm/fork/getPathFromState.js +6 -1
- package/dist/esm/fork/getPathFromState.js.map +1 -1
- package/dist/esm/fork/getPathFromState.mjs.map +1 -1
- package/dist/esm/fork/getPathFromState.native.js.map +1 -1
- package/dist/esm/fork/getStateFromPath.test.js.map +1 -1
- package/dist/esm/fork/getStateFromPath.test.mjs.map +1 -1
- package/dist/esm/fork/getStateFromPath.test.native.js.map +1 -1
- package/dist/esm/hooks.js.map +1 -1
- package/dist/esm/hooks.mjs.map +1 -1
- package/dist/esm/hooks.native.js.map +1 -1
- package/dist/esm/router/Route.js.map +1 -1
- package/dist/esm/router/Route.mjs.map +1 -1
- package/dist/esm/router/Route.native.js.map +1 -1
- package/dist/esm/router/RouteInfoContext.js +1 -7
- package/dist/esm/router/RouteInfoContext.js.map +1 -1
- package/dist/esm/router/RouteInfoContext.mjs.map +1 -1
- package/dist/esm/router/RouteInfoContext.native.js.map +1 -1
- package/dist/esm/router/useViteRoutes.js.map +1 -1
- package/dist/esm/router/useViteRoutes.mjs.map +1 -1
- package/dist/esm/router/useViteRoutes.native.js.map +1 -1
- package/dist/esm/server/oneServe.js +1 -6
- package/dist/esm/server/oneServe.js.map +1 -1
- package/dist/esm/server/oneServe.mjs.map +1 -1
- package/dist/esm/server/oneServe.native.js.map +1 -1
- package/dist/esm/setup.js +0 -6
- package/dist/esm/setup.js.map +1 -1
- package/dist/esm/setup.mjs +0 -8
- package/dist/esm/setup.mjs.map +1 -1
- package/dist/esm/views/Navigator.js +9 -20
- package/dist/esm/views/Navigator.js.map +1 -1
- package/dist/esm/views/Navigator.mjs.map +1 -1
- package/dist/esm/views/Navigator.native.js.map +1 -1
- package/dist/esm/vite/one.js +5 -48
- package/dist/esm/vite/one.js.map +1 -1
- package/dist/esm/vite/one.mjs +4 -50
- package/dist/esm/vite/one.mjs.map +1 -1
- package/dist/esm/vite/one.native.js +1 -53
- package/dist/esm/vite/one.native.js.map +1 -1
- package/dist/esm/vite/plugins/clientTreeShakePlugin.js +8 -2
- package/dist/esm/vite/plugins/clientTreeShakePlugin.js.map +1 -1
- package/dist/esm/vite/plugins/clientTreeShakePlugin.mjs.map +1 -1
- package/dist/esm/vite/plugins/clientTreeShakePlugin.native.js.map +1 -1
- package/dist/esm/vite/plugins/generateFileSystemRouteTypesPlugin.js +3 -1
- package/dist/esm/vite/plugins/generateFileSystemRouteTypesPlugin.js.map +1 -1
- package/dist/esm/vite/plugins/generateFileSystemRouteTypesPlugin.mjs.map +1 -1
- package/dist/esm/vite/plugins/generateFileSystemRouteTypesPlugin.native.js.map +1 -1
- package/package.json +23 -26
- package/src/Root.tsx +3 -7
- package/src/cli/dev.ts +7 -0
- package/src/createApp.tsx +2 -6
- package/src/createHandleRequest.ts +4 -1
- package/src/fork/__tests__/getPathFromState.test.tsx +107 -128
- package/src/fork/__tests__/getStateFromPath.test.tsx +95 -181
- package/src/fork/getPathFromState.ts +6 -1
- package/src/fork/getStateFromPath.test.ts +0 -5
- package/src/hooks.tsx +1 -3
- package/src/router/Route.tsx +1 -3
- package/src/router/RouteInfoContext.tsx +1 -3
- package/src/router/useViteRoutes.tsx +5 -1
- package/src/server/oneServe.ts +2 -7
- package/src/setup.ts +10 -9
- package/src/views/Navigator.tsx +9 -21
- package/src/vite/one.ts +80 -75
- package/src/vite/plugins/clientTreeShakePlugin.ts +8 -2
- package/src/vite/plugins/generateFileSystemRouteTypesPlugin.tsx +3 -1
- package/src/vite/types.ts +5 -21
- package/types/Root.d.ts.map +1 -1
- package/types/cli/dev.d.ts.map +1 -1
- package/types/createApp.d.ts.map +1 -1
- package/types/createHandleRequest.d.ts.map +1 -1
- package/types/fork/getPathFromState.d.ts.map +1 -1
- package/types/hooks.d.ts.map +1 -1
- package/types/router/Route.d.ts.map +1 -1
- package/types/router/RouteInfoContext.d.ts.map +1 -1
- package/types/router/useViteRoutes.d.ts.map +1 -1
- package/types/server/oneServe.d.ts.map +1 -1
- package/types/setup.d.ts.map +1 -1
- package/types/views/Navigator.d.ts +1 -1
- package/types/views/Navigator.d.ts.map +1 -1
- package/types/vite/one.d.ts.map +1 -1
- package/types/vite/plugins/clientTreeShakePlugin.d.ts.map +1 -1
- package/types/vite/plugins/generateFileSystemRouteTypesPlugin.d.ts.map +1 -1
- package/types/vite/types.d.ts +4 -15
- package/types/vite/types.d.ts.map +1 -1
@@ -66,9 +66,7 @@ test.skip("decodes encoded params in path", () => {
|
|
66
66
|
}
|
67
67
|
]
|
68
68
|
};
|
69
|
-
expect(getStateFromPath(path, config)).toEqual(state), expect(
|
70
|
-
getPathFromState(getStateFromPath(path, config), config)
|
71
|
-
).toEqual(path);
|
69
|
+
expect(getStateFromPath(path, config)).toEqual(state), expect(getPathFromState(getStateFromPath(path, config), config)).toEqual(path);
|
72
70
|
});
|
73
71
|
test.skip("decodes encoded params in path that have encoded /", () => {
|
74
72
|
const path = "/foo/bar/bar_%2F_foo", config = {
|
@@ -98,9 +96,7 @@ test.skip("decodes encoded params in path that have encoded /", () => {
|
|
98
96
|
}
|
99
97
|
]
|
100
98
|
};
|
101
|
-
expect(getStateFromPath(path, config)).toEqual(state), expect(
|
102
|
-
getPathFromState(getStateFromPath(path, config), config)
|
103
|
-
).toEqual(path);
|
99
|
+
expect(getStateFromPath(path, config)).toEqual(state), expect(getPathFromState(getStateFromPath(path, config), config)).toEqual(path);
|
104
100
|
});
|
105
101
|
test.skip("converts path string to initial state with config", () => {
|
106
102
|
const path = "/foo/bar/sweet/apple/baz/jane?count=10&answer=42&valid=true", config = {
|
@@ -156,9 +152,7 @@ test.skip("converts path string to initial state with config", () => {
|
|
156
152
|
}
|
157
153
|
]
|
158
154
|
};
|
159
|
-
expect(getStateFromPath(path, config)).toEqual(state), expect(
|
160
|
-
getStateFromPath(getPathFromState(state, config), config)
|
161
|
-
).toEqual(state);
|
155
|
+
expect(getStateFromPath(path, config)).toEqual(state), expect(getStateFromPath(getPathFromState(state, config), config)).toEqual(state);
|
162
156
|
});
|
163
157
|
test("handles leading slash when converting", () => {
|
164
158
|
const path = "/foo/bar/?count=42";
|
@@ -280,9 +274,7 @@ test.skip("converts path string to initial state with config with nested screens
|
|
280
274
|
}
|
281
275
|
]
|
282
276
|
};
|
283
|
-
expect(getStateFromPath(path, config)).toEqual(state), expect(
|
284
|
-
getStateFromPath(getPathFromState(state, config), config)
|
285
|
-
).toEqual(state);
|
277
|
+
expect(getStateFromPath(path, config)).toEqual(state), expect(getStateFromPath(getPathFromState(state, config), config)).toEqual(state);
|
286
278
|
});
|
287
279
|
test.skip("converts path string to initial state with config with nested screens and unused parse functions", () => {
|
288
280
|
const path = "/foe/baz/jane?count=10&answer=42&valid=true", config = {
|
@@ -336,9 +328,9 @@ test.skip("converts path string to initial state with config with nested screens
|
|
336
328
|
}
|
337
329
|
]
|
338
330
|
};
|
339
|
-
expect(getStateFromPath(path, config)).toEqual(state), expect(
|
340
|
-
|
341
|
-
)
|
331
|
+
expect(getStateFromPath(path, config)).toEqual(state), expect(getStateFromPath(getPathFromState(state, config), config)).toEqual(
|
332
|
+
changePath(state, "/foe/baz/Jane?count=10&answer=42&valid=true")
|
333
|
+
);
|
342
334
|
});
|
343
335
|
test.skip("handles nested object with unused configs and with parse in it", () => {
|
344
336
|
const path = "/bar/sweet/apple/foe/bis/jane?count=10&answer=42&valid=true", config = {
|
@@ -420,9 +412,7 @@ test.skip("handles nested object with unused configs and with parse in it", () =
|
|
420
412
|
}
|
421
413
|
]
|
422
414
|
};
|
423
|
-
expect(getStateFromPath(path, config)).toEqual(state), expect(
|
424
|
-
getStateFromPath(getPathFromState(state, config), config)
|
425
|
-
).toEqual(state);
|
415
|
+
expect(getStateFromPath(path, config)).toEqual(state), expect(getStateFromPath(getPathFromState(state, config), config)).toEqual(state);
|
426
416
|
});
|
427
417
|
test("handles parse in nested object for second route depth", () => {
|
428
418
|
const path = "/baz", config = {
|
@@ -464,9 +454,7 @@ test("handles parse in nested object for second route depth", () => {
|
|
464
454
|
}
|
465
455
|
]
|
466
456
|
};
|
467
|
-
expect(getStateFromPath(path, config)).toEqual(state), expect(
|
468
|
-
getStateFromPath(getPathFromState(state, config), config)
|
469
|
-
).toEqual(state);
|
457
|
+
expect(getStateFromPath(path, config)).toEqual(state), expect(getStateFromPath(getPathFromState(state, config), config)).toEqual(state);
|
470
458
|
});
|
471
459
|
test("handles parse in nested object for second route depth and and path and parse in roots", () => {
|
472
460
|
const path = "/baz", config = {
|
@@ -509,9 +497,7 @@ test("handles parse in nested object for second route depth and and path and par
|
|
509
497
|
}
|
510
498
|
]
|
511
499
|
};
|
512
|
-
expect(getStateFromPath(path, config)).toEqual(state), expect(
|
513
|
-
getStateFromPath(getPathFromState(state, config), config)
|
514
|
-
).toEqual(state);
|
500
|
+
expect(getStateFromPath(path, config)).toEqual(state), expect(getStateFromPath(getPathFromState(state, config), config)).toEqual(state);
|
515
501
|
});
|
516
502
|
test.skip("handles path at top level", () => {
|
517
503
|
const path = "/foo/fruits/apple", config = {
|
@@ -539,9 +525,7 @@ test.skip("handles path at top level", () => {
|
|
539
525
|
}
|
540
526
|
]
|
541
527
|
};
|
542
|
-
expect(getStateFromPath(path, config)).toEqual(state), expect(
|
543
|
-
getStateFromPath(getPathFromState(state, config), config)
|
544
|
-
).toEqual(state);
|
528
|
+
expect(getStateFromPath(path, config)).toEqual(state), expect(getStateFromPath(getPathFromState(state, config), config)).toEqual(state);
|
545
529
|
});
|
546
530
|
test("handles initialRouteName at top level", () => {
|
547
531
|
const path = "/baz", config = {
|
@@ -577,9 +561,7 @@ test("handles initialRouteName at top level", () => {
|
|
577
561
|
}
|
578
562
|
]
|
579
563
|
};
|
580
|
-
expect(getStateFromPath(path, config)).toEqual(state), expect(
|
581
|
-
getStateFromPath(getPathFromState(state, config), config)
|
582
|
-
).toEqual(state);
|
564
|
+
expect(getStateFromPath(path, config)).toEqual(state), expect(getStateFromPath(getPathFromState(state, config), config)).toEqual(state);
|
583
565
|
});
|
584
566
|
test("handles initialRouteName inside a screen", () => {
|
585
567
|
const path = "/baz", config = {
|
@@ -617,9 +599,7 @@ test("handles initialRouteName inside a screen", () => {
|
|
617
599
|
}
|
618
600
|
]
|
619
601
|
};
|
620
|
-
expect(getStateFromPath(path, config)).toEqual(state), expect(
|
621
|
-
getStateFromPath(getPathFromState(state, config), config)
|
622
|
-
).toEqual(state);
|
602
|
+
expect(getStateFromPath(path, config)).toEqual(state), expect(getStateFromPath(getPathFromState(state, config), config)).toEqual(state);
|
623
603
|
});
|
624
604
|
test("handles initialRouteName included in path", () => {
|
625
605
|
const path = "/baz", config = {
|
@@ -653,9 +633,7 @@ test("handles initialRouteName included in path", () => {
|
|
653
633
|
}
|
654
634
|
]
|
655
635
|
};
|
656
|
-
expect(getStateFromPath(path, config)).toEqual(state), expect(
|
657
|
-
getStateFromPath(getPathFromState(state, config), config)
|
658
|
-
).toEqual(state);
|
636
|
+
expect(getStateFromPath(path, config)).toEqual(state), expect(getStateFromPath(getPathFromState(state, config), config)).toEqual(state);
|
659
637
|
});
|
660
638
|
test.skip("handles two initialRouteNames", () => {
|
661
639
|
const path = "/bar/sweet/apple/foe/bis/jane?answer=42&count=10&valid=true", config = {
|
@@ -740,9 +718,7 @@ test.skip("handles two initialRouteNames", () => {
|
|
740
718
|
}
|
741
719
|
]
|
742
720
|
};
|
743
|
-
expect(getStateFromPath(path, config)).toEqual(state), expect(
|
744
|
-
getStateFromPath(getPathFromState(state, config), config)
|
745
|
-
).toEqual(state);
|
721
|
+
expect(getStateFromPath(path, config)).toEqual(state), expect(getStateFromPath(getPathFromState(state, config), config)).toEqual(state);
|
746
722
|
});
|
747
723
|
test.skip("accepts initialRouteName without config for it", () => {
|
748
724
|
const path = "/bar/sweet/apple/foe/bis/jane?answer=42&count=10&valid=true", config = {
|
@@ -827,9 +803,7 @@ test.skip("accepts initialRouteName without config for it", () => {
|
|
827
803
|
}
|
828
804
|
]
|
829
805
|
};
|
830
|
-
expect(getStateFromPath(path, config)).toEqual(state), expect(
|
831
|
-
getStateFromPath(getPathFromState(state, config), config)
|
832
|
-
).toEqual(state);
|
806
|
+
expect(getStateFromPath(path, config)).toEqual(state), expect(getStateFromPath(getPathFromState(state, config), config)).toEqual(state);
|
833
807
|
});
|
834
808
|
test("returns undefined if no matching screen is present (top level path)", () => {
|
835
809
|
expect(getStateFromPath("/foo/bar", {
|
@@ -913,9 +887,9 @@ test.skip("returns matching screen if path is empty", () => {
|
|
913
887
|
}
|
914
888
|
]
|
915
889
|
};
|
916
|
-
expect(getStateFromPath(path, config)).toEqual(state), expect(
|
917
|
-
|
918
|
-
)
|
890
|
+
expect(getStateFromPath(path, config)).toEqual(state), expect(getStateFromPath(getPathFromState(state, config), config)).toEqual(
|
891
|
+
changePath(state, "")
|
892
|
+
);
|
919
893
|
});
|
920
894
|
test.skip("returns matching screen if path is only slash", () => {
|
921
895
|
const path = "/", config = {
|
@@ -949,9 +923,9 @@ test.skip("returns matching screen if path is only slash", () => {
|
|
949
923
|
}
|
950
924
|
]
|
951
925
|
};
|
952
|
-
expect(getStateFromPath(path, config)).toEqual(state), expect(
|
953
|
-
|
954
|
-
)
|
926
|
+
expect(getStateFromPath(path, config)).toEqual(state), expect(getStateFromPath(getPathFromState(state, config), config)).toEqual(
|
927
|
+
changePath(state, "")
|
928
|
+
);
|
955
929
|
});
|
956
930
|
test("returns matching screen with params if path is empty", () => {
|
957
931
|
const path = "?foo=42", config = {
|
@@ -988,9 +962,9 @@ test("returns matching screen with params if path is empty", () => {
|
|
988
962
|
}
|
989
963
|
]
|
990
964
|
};
|
991
|
-
expect(getStateFromPath(path, config)).toEqual(state), expect(
|
992
|
-
|
993
|
-
)
|
965
|
+
expect(getStateFromPath(path, config)).toEqual(state), expect(getStateFromPath(getPathFromState(state, config), config)).toEqual(
|
966
|
+
changePath(state, "/?foo=42")
|
967
|
+
);
|
994
968
|
});
|
995
969
|
test("doesn't match nested screen if path is empty", () => {
|
996
970
|
expect(getStateFromPath("", {
|
@@ -1049,9 +1023,7 @@ test.skip("chooses more exhaustive pattern", () => {
|
|
1049
1023
|
}
|
1050
1024
|
]
|
1051
1025
|
};
|
1052
|
-
expect(getStateFromPath(path, config)).toEqual(state), expect(
|
1053
|
-
getStateFromPath(getPathFromState(state, config), config)
|
1054
|
-
).toEqual(state);
|
1026
|
+
expect(getStateFromPath(path, config)).toEqual(state), expect(getStateFromPath(getPathFromState(state, config), config)).toEqual(state);
|
1055
1027
|
});
|
1056
1028
|
test("handles same paths beginnings", () => {
|
1057
1029
|
const path = "/foos", config = {
|
@@ -1086,9 +1058,7 @@ test("handles same paths beginnings", () => {
|
|
1086
1058
|
}
|
1087
1059
|
]
|
1088
1060
|
};
|
1089
|
-
expect(getStateFromPath(path, config)).toEqual(state), expect(
|
1090
|
-
getStateFromPath(getPathFromState(state, config), config)
|
1091
|
-
).toEqual(state);
|
1061
|
+
expect(getStateFromPath(path, config)).toEqual(state), expect(getStateFromPath(getPathFromState(state, config), config)).toEqual(state);
|
1092
1062
|
});
|
1093
1063
|
test.skip("handles same paths beginnings with params", () => {
|
1094
1064
|
const path = "/foos/5", config = {
|
@@ -1127,9 +1097,7 @@ test.skip("handles same paths beginnings with params", () => {
|
|
1127
1097
|
}
|
1128
1098
|
]
|
1129
1099
|
};
|
1130
|
-
expect(getStateFromPath(path, config)).toEqual(state), expect(
|
1131
|
-
getStateFromPath(getPathFromState(state, config), config)
|
1132
|
-
).toEqual(state);
|
1100
|
+
expect(getStateFromPath(path, config)).toEqual(state), expect(getStateFromPath(getPathFromState(state, config), config)).toEqual(state);
|
1133
1101
|
});
|
1134
1102
|
test.skip("handles not taking path with too many segments", () => {
|
1135
1103
|
const path = "/foos/5", config = {
|
@@ -1175,9 +1143,7 @@ test.skip("handles not taking path with too many segments", () => {
|
|
1175
1143
|
}
|
1176
1144
|
]
|
1177
1145
|
};
|
1178
|
-
expect(getStateFromPath(path, config)).toEqual(state), expect(
|
1179
|
-
getStateFromPath(getPathFromState(state, config), config)
|
1180
|
-
).toEqual(state);
|
1146
|
+
expect(getStateFromPath(path, config)).toEqual(state), expect(getStateFromPath(getPathFromState(state, config), config)).toEqual(state);
|
1181
1147
|
});
|
1182
1148
|
test.skip("handles differently ordered params v1", () => {
|
1183
1149
|
const path = "/foos/5/res/20", config = {
|
@@ -1223,9 +1189,7 @@ test.skip("handles differently ordered params v1", () => {
|
|
1223
1189
|
}
|
1224
1190
|
]
|
1225
1191
|
};
|
1226
|
-
expect(getStateFromPath(path, config)).toEqual(state), expect(
|
1227
|
-
getStateFromPath(getPathFromState(state, config), config)
|
1228
|
-
).toEqual(state);
|
1192
|
+
expect(getStateFromPath(path, config)).toEqual(state), expect(getStateFromPath(getPathFromState(state, config), config)).toEqual(state);
|
1229
1193
|
});
|
1230
1194
|
test.skip("handles differently ordered params v2", () => {
|
1231
1195
|
const path = "/5/20/foos/res", config = {
|
@@ -1271,9 +1235,7 @@ test.skip("handles differently ordered params v2", () => {
|
|
1271
1235
|
}
|
1272
1236
|
]
|
1273
1237
|
};
|
1274
|
-
expect(getStateFromPath(path, config)).toEqual(state), expect(
|
1275
|
-
getStateFromPath(getPathFromState(state, config), config)
|
1276
|
-
).toEqual(state);
|
1238
|
+
expect(getStateFromPath(path, config)).toEqual(state), expect(getStateFromPath(getPathFromState(state, config), config)).toEqual(state);
|
1277
1239
|
});
|
1278
1240
|
test.skip("handles differently ordered params v3", () => {
|
1279
1241
|
const path = "/foos/5/20/res", config = {
|
@@ -1319,9 +1281,7 @@ test.skip("handles differently ordered params v3", () => {
|
|
1319
1281
|
}
|
1320
1282
|
]
|
1321
1283
|
};
|
1322
|
-
expect(getStateFromPath(path, config)).toEqual(state), expect(
|
1323
|
-
getStateFromPath(getPathFromState(state, config), config)
|
1324
|
-
).toEqual(state);
|
1284
|
+
expect(getStateFromPath(path, config)).toEqual(state), expect(getStateFromPath(getPathFromState(state, config), config)).toEqual(state);
|
1325
1285
|
});
|
1326
1286
|
test.skip("handles differently ordered params v4", () => {
|
1327
1287
|
const path = "5/foos/res/20", config = {
|
@@ -1367,9 +1327,9 @@ test.skip("handles differently ordered params v4", () => {
|
|
1367
1327
|
}
|
1368
1328
|
]
|
1369
1329
|
};
|
1370
|
-
expect(getStateFromPath(path, config)).toEqual(state), expect(
|
1371
|
-
|
1372
|
-
)
|
1330
|
+
expect(getStateFromPath(path, config)).toEqual(state), expect(getStateFromPath(getPathFromState(state, config), config)).toEqual(
|
1331
|
+
changePath(state, "/5/foos/res/20")
|
1332
|
+
);
|
1373
1333
|
});
|
1374
1334
|
test.skip("handles simple optional params", () => {
|
1375
1335
|
const path = "/foos/5", config = {
|
@@ -1415,9 +1375,7 @@ test.skip("handles simple optional params", () => {
|
|
1415
1375
|
}
|
1416
1376
|
]
|
1417
1377
|
};
|
1418
|
-
expect(getStateFromPath(path, config)).toEqual(state), expect(
|
1419
|
-
getStateFromPath(getPathFromState(state, config), config)
|
1420
|
-
).toEqual(state);
|
1378
|
+
expect(getStateFromPath(path, config)).toEqual(state), expect(getStateFromPath(getPathFromState(state, config), config)).toEqual(state);
|
1421
1379
|
});
|
1422
1380
|
test.skip("handle 2 optional params at the end v1", () => {
|
1423
1381
|
const path = "/foos/5", config = {
|
@@ -1463,9 +1421,7 @@ test.skip("handle 2 optional params at the end v1", () => {
|
|
1463
1421
|
}
|
1464
1422
|
]
|
1465
1423
|
};
|
1466
|
-
expect(getStateFromPath(path, config)).toEqual(state), expect(
|
1467
|
-
getStateFromPath(getPathFromState(state, config), config)
|
1468
|
-
).toEqual(state);
|
1424
|
+
expect(getStateFromPath(path, config)).toEqual(state), expect(getStateFromPath(getPathFromState(state, config), config)).toEqual(state);
|
1469
1425
|
});
|
1470
1426
|
test.skip("handle 2 optional params at the end v2", () => {
|
1471
1427
|
const path = "/foos/5/10", config = {
|
@@ -1511,9 +1467,7 @@ test.skip("handle 2 optional params at the end v2", () => {
|
|
1511
1467
|
}
|
1512
1468
|
]
|
1513
1469
|
};
|
1514
|
-
expect(getStateFromPath(path, config)).toEqual(state), expect(
|
1515
|
-
getStateFromPath(getPathFromState(state, config), config)
|
1516
|
-
).toEqual(state);
|
1470
|
+
expect(getStateFromPath(path, config)).toEqual(state), expect(getStateFromPath(getPathFromState(state, config), config)).toEqual(state);
|
1517
1471
|
});
|
1518
1472
|
test.skip("handle 2 optional params at the end v3", () => {
|
1519
1473
|
const path = "/foos/5/10/15", config = {
|
@@ -1560,9 +1514,7 @@ test.skip("handle 2 optional params at the end v3", () => {
|
|
1560
1514
|
}
|
1561
1515
|
]
|
1562
1516
|
};
|
1563
|
-
expect(getStateFromPath(path, config)).toEqual(state), expect(
|
1564
|
-
getStateFromPath(getPathFromState(state, config), config)
|
1565
|
-
).toEqual(state);
|
1517
|
+
expect(getStateFromPath(path, config)).toEqual(state), expect(getStateFromPath(getPathFromState(state, config), config)).toEqual(state);
|
1566
1518
|
});
|
1567
1519
|
test.skip("handle optional params in the middle v1", () => {
|
1568
1520
|
const path = "/foos/5/10", config = {
|
@@ -1609,9 +1561,7 @@ test.skip("handle optional params in the middle v1", () => {
|
|
1609
1561
|
}
|
1610
1562
|
]
|
1611
1563
|
};
|
1612
|
-
expect(getStateFromPath(path, config)).toEqual(state), expect(
|
1613
|
-
getStateFromPath(getPathFromState(state, config), config)
|
1614
|
-
).toEqual(state);
|
1564
|
+
expect(getStateFromPath(path, config)).toEqual(state), expect(getStateFromPath(getPathFromState(state, config), config)).toEqual(state);
|
1615
1565
|
});
|
1616
1566
|
test.skip("handle optional params in the middle v2", () => {
|
1617
1567
|
const path = "/foos/5/10/15", config = {
|
@@ -1658,9 +1608,7 @@ test.skip("handle optional params in the middle v2", () => {
|
|
1658
1608
|
}
|
1659
1609
|
]
|
1660
1610
|
};
|
1661
|
-
expect(getStateFromPath(path, config)).toEqual(state), expect(
|
1662
|
-
getStateFromPath(getPathFromState(state, config), config)
|
1663
|
-
).toEqual(state);
|
1611
|
+
expect(getStateFromPath(path, config)).toEqual(state), expect(getStateFromPath(getPathFromState(state, config), config)).toEqual(state);
|
1664
1612
|
});
|
1665
1613
|
test.skip("handle optional params in the middle v3", () => {
|
1666
1614
|
const path = "/foos/5/10/15", config = {
|
@@ -1708,9 +1656,7 @@ test.skip("handle optional params in the middle v3", () => {
|
|
1708
1656
|
}
|
1709
1657
|
]
|
1710
1658
|
};
|
1711
|
-
expect(getStateFromPath(path, config)).toEqual(state), expect(
|
1712
|
-
getStateFromPath(getPathFromState(state, config), config)
|
1713
|
-
).toEqual(state);
|
1659
|
+
expect(getStateFromPath(path, config)).toEqual(state), expect(getStateFromPath(getPathFromState(state, config), config)).toEqual(state);
|
1714
1660
|
});
|
1715
1661
|
test.skip("handle optional params in the middle v4", () => {
|
1716
1662
|
const path = "/foos/5/10", config = {
|
@@ -1758,9 +1704,7 @@ test.skip("handle optional params in the middle v4", () => {
|
|
1758
1704
|
}
|
1759
1705
|
]
|
1760
1706
|
};
|
1761
|
-
expect(getStateFromPath(path, config)).toEqual(state), expect(
|
1762
|
-
getStateFromPath(getPathFromState(state, config), config)
|
1763
|
-
).toEqual(state);
|
1707
|
+
expect(getStateFromPath(path, config)).toEqual(state), expect(getStateFromPath(getPathFromState(state, config), config)).toEqual(state);
|
1764
1708
|
});
|
1765
1709
|
test.skip("handle optional params in the middle v5", () => {
|
1766
1710
|
const path = "/foos/5/10/15", config = {
|
@@ -1808,9 +1752,7 @@ test.skip("handle optional params in the middle v5", () => {
|
|
1808
1752
|
}
|
1809
1753
|
]
|
1810
1754
|
};
|
1811
|
-
expect(getStateFromPath(path, config)).toEqual(state), expect(
|
1812
|
-
getStateFromPath(getPathFromState(state, config), config)
|
1813
|
-
).toEqual(state);
|
1755
|
+
expect(getStateFromPath(path, config)).toEqual(state), expect(getStateFromPath(getPathFromState(state, config), config)).toEqual(state);
|
1814
1756
|
});
|
1815
1757
|
test.skip("handle optional params in the beginning v1", () => {
|
1816
1758
|
const path = "5/10/foos/15", config = {
|
@@ -1858,9 +1800,9 @@ test.skip("handle optional params in the beginning v1", () => {
|
|
1858
1800
|
}
|
1859
1801
|
]
|
1860
1802
|
};
|
1861
|
-
expect(getStateFromPath(path, config)).toEqual(state), expect(
|
1862
|
-
|
1863
|
-
)
|
1803
|
+
expect(getStateFromPath(path, config)).toEqual(state), expect(getStateFromPath(getPathFromState(state, config), config)).toEqual(
|
1804
|
+
changePath(state, "/5/10/foos/15")
|
1805
|
+
);
|
1864
1806
|
});
|
1865
1807
|
test.skip("handle optional params in the beginning v2", () => {
|
1866
1808
|
const path = "5/10/foos/15", config = {
|
@@ -1908,9 +1850,9 @@ test.skip("handle optional params in the beginning v2", () => {
|
|
1908
1850
|
}
|
1909
1851
|
]
|
1910
1852
|
};
|
1911
|
-
expect(getStateFromPath(path, config)).toEqual(state), expect(
|
1912
|
-
|
1913
|
-
)
|
1853
|
+
expect(getStateFromPath(path, config)).toEqual(state), expect(getStateFromPath(getPathFromState(state, config), config)).toEqual(
|
1854
|
+
changePath(state, "/5/10/foos/15")
|
1855
|
+
);
|
1914
1856
|
});
|
1915
1857
|
test.skip("merges parent patterns if needed", () => {
|
1916
1858
|
const path = "foo/42/baz/babel", config = {
|
@@ -1942,9 +1884,9 @@ test.skip("merges parent patterns if needed", () => {
|
|
1942
1884
|
}
|
1943
1885
|
]
|
1944
1886
|
};
|
1945
|
-
expect(getStateFromPath(path, config)).toEqual(state), expect(
|
1946
|
-
|
1947
|
-
)
|
1887
|
+
expect(getStateFromPath(path, config)).toEqual(state), expect(getStateFromPath(getPathFromState(state, config), config)).toEqual(
|
1888
|
+
changePath(state, "/foo/42/baz/babel")
|
1889
|
+
);
|
1948
1890
|
});
|
1949
1891
|
test.skip("ignores extra slashes in the pattern", () => {
|
1950
1892
|
const path = "/bar/42", config = {
|
@@ -1973,9 +1915,7 @@ test.skip("ignores extra slashes in the pattern", () => {
|
|
1973
1915
|
}
|
1974
1916
|
]
|
1975
1917
|
};
|
1976
|
-
expect(getStateFromPath(path, config)).toEqual(state), expect(
|
1977
|
-
getStateFromPath(getPathFromState(state, config), config)
|
1978
|
-
).toEqual(state);
|
1918
|
+
expect(getStateFromPath(path, config)).toEqual(state), expect(getStateFromPath(getPathFromState(state, config), config)).toEqual(state);
|
1979
1919
|
});
|
1980
1920
|
test.skip("matches wildcard patterns at root", () => {
|
1981
1921
|
const path = "/test/bar/42/whatever", config = {
|
@@ -1992,9 +1932,9 @@ test.skip("matches wildcard patterns at root", () => {
|
|
1992
1932
|
}, state = {
|
1993
1933
|
routes: [{ name: "404", path }]
|
1994
1934
|
};
|
1995
|
-
expect(getStateFromPath(path, config)).toEqual(state), expect(
|
1996
|
-
|
1997
|
-
)
|
1935
|
+
expect(getStateFromPath(path, config)).toEqual(state), expect(getStateFromPath(getPathFromState(state, config), config)).toEqual(
|
1936
|
+
changePath(state, "/404")
|
1937
|
+
);
|
1998
1938
|
});
|
1999
1939
|
test.skip("matches wildcard patterns at nested level", () => {
|
2000
1940
|
const path = "/bar/42/whatever/baz/initt", config = {
|
@@ -2028,9 +1968,9 @@ test.skip("matches wildcard patterns at nested level", () => {
|
|
2028
1968
|
}
|
2029
1969
|
]
|
2030
1970
|
};
|
2031
|
-
expect(getStateFromPath(path, config)).toEqual(state), expect(
|
2032
|
-
|
2033
|
-
)
|
1971
|
+
expect(getStateFromPath(path, config)).toEqual(state), expect(getStateFromPath(getPathFromState(state, config), config)).toEqual(
|
1972
|
+
changePath(state, "/bar/42/404")
|
1973
|
+
);
|
2034
1974
|
});
|
2035
1975
|
test.skip("matches wildcard patterns at nested level with exact", () => {
|
2036
1976
|
const path = "/whatever", config = {
|
@@ -2067,9 +2007,9 @@ test.skip("matches wildcard patterns at nested level with exact", () => {
|
|
2067
2007
|
}
|
2068
2008
|
]
|
2069
2009
|
};
|
2070
|
-
expect(getStateFromPath(path, config)).toEqual(state), expect(
|
2071
|
-
|
2072
|
-
)
|
2010
|
+
expect(getStateFromPath(path, config)).toEqual(state), expect(getStateFromPath(getPathFromState(state, config), config)).toEqual(
|
2011
|
+
changePath(state, "/404")
|
2012
|
+
);
|
2073
2013
|
});
|
2074
2014
|
test.skip("tries to match wildcard patterns at the end", () => {
|
2075
2015
|
const path = "/bar/42/test", config = {
|
@@ -2105,9 +2045,7 @@ test.skip("tries to match wildcard patterns at the end", () => {
|
|
2105
2045
|
}
|
2106
2046
|
]
|
2107
2047
|
};
|
2108
|
-
expect(getStateFromPath(path, config)).toEqual(state), expect(
|
2109
|
-
getStateFromPath(getPathFromState(state, config), config)
|
2110
|
-
).toEqual(state);
|
2048
|
+
expect(getStateFromPath(path, config)).toEqual(state), expect(getStateFromPath(getPathFromState(state, config), config)).toEqual(state);
|
2111
2049
|
});
|
2112
2050
|
test.skip("uses nearest parent wildcard match for unmatched paths", () => {
|
2113
2051
|
const path = "/bar/42/baz/test", config = {
|
@@ -2134,9 +2072,9 @@ test.skip("uses nearest parent wildcard match for unmatched paths", () => {
|
|
2134
2072
|
}
|
2135
2073
|
]
|
2136
2074
|
};
|
2137
|
-
expect(getStateFromPath(path, config)).toEqual(state), expect(
|
2138
|
-
|
2139
|
-
)
|
2075
|
+
expect(getStateFromPath(path, config)).toEqual(state), expect(getStateFromPath(getPathFromState(state, config), config)).toEqual(
|
2076
|
+
changePath(state, "/404")
|
2077
|
+
);
|
2140
2078
|
});
|
2141
2079
|
test.skip("matches screen with overlapping initial path and wildcard", () => {
|
2142
2080
|
const path = "/bar/42/baz/test/whatever", config = {
|
@@ -2163,9 +2101,9 @@ test.skip("matches screen with overlapping initial path and wildcard", () => {
|
|
2163
2101
|
}
|
2164
2102
|
]
|
2165
2103
|
};
|
2166
|
-
expect(getStateFromPath(path, config)).toEqual(state), expect(
|
2167
|
-
|
2168
|
-
)
|
2104
|
+
expect(getStateFromPath(path, config)).toEqual(state), expect(getStateFromPath(getPathFromState(state, config), config)).toEqual(
|
2105
|
+
changePath(state, "/bar/42/Baz")
|
2106
|
+
);
|
2169
2107
|
});
|
2170
2108
|
test("throws if two screens map to the same pattern", () => {
|
2171
2109
|
const path = "/bar/42/baz/test";
|
@@ -2249,9 +2187,7 @@ test("correctly applies initialRouteName for config with similar route names", (
|
|
2249
2187
|
}
|
2250
2188
|
]
|
2251
2189
|
};
|
2252
|
-
expect(getStateFromPath(path, config)).toEqual(state), expect(
|
2253
|
-
getStateFromPath(getPathFromState(state, config), config)
|
2254
|
-
).toEqual(state);
|
2190
|
+
expect(getStateFromPath(path, config)).toEqual(state), expect(getStateFromPath(getPathFromState(state, config), config)).toEqual(state);
|
2255
2191
|
});
|
2256
2192
|
test("correctly applies initialRouteName for config with similar route names v2", () => {
|
2257
2193
|
const path = "/earnings/weekly-earnings", config = {
|
@@ -2302,9 +2238,7 @@ test("correctly applies initialRouteName for config with similar route names v2"
|
|
2302
2238
|
}
|
2303
2239
|
]
|
2304
2240
|
};
|
2305
|
-
expect(getStateFromPath(path, config)).toEqual(state), expect(
|
2306
|
-
getStateFromPath(getPathFromState(state, config), config)
|
2307
|
-
).toEqual(state);
|
2241
|
+
expect(getStateFromPath(path, config)).toEqual(state), expect(getStateFromPath(getPathFromState(state, config), config)).toEqual(state);
|
2308
2242
|
});
|
2309
2243
|
test.skip("throws when invalid properties are specified in the config", () => {
|
2310
2244
|
expect(
|
@@ -2397,9 +2331,7 @@ test.skip("encodes special characters in params", () => {
|
|
2397
2331
|
}
|
2398
2332
|
]
|
2399
2333
|
};
|
2400
|
-
expect(getPathFromState(state, config)).toBe(`/${path}`), expect(getPathFromState(getStateFromPath(path, config), config)).toBe(
|
2401
|
-
`/${path}`
|
2402
|
-
);
|
2334
|
+
expect(getPathFromState(state, config)).toBe(`/${path}`), expect(getPathFromState(getStateFromPath(path, config), config)).toBe(`/${path}`);
|
2403
2335
|
});
|
2404
2336
|
test.skip("resolves nested path params with same name to correct screen", () => {
|
2405
2337
|
const path = "/foo/42/bar/43", config = {
|
@@ -2444,9 +2376,7 @@ test("parses / same as empty string", () => {
|
|
2444
2376
|
}
|
2445
2377
|
}
|
2446
2378
|
};
|
2447
|
-
expect(getStateFromPath("/", config)).toEqual(
|
2448
|
-
getStateFromPath("", config)
|
2449
|
-
);
|
2379
|
+
expect(getStateFromPath("/", config)).toEqual(getStateFromPath("", config));
|
2450
2380
|
});
|
2451
2381
|
test.skip("matches regexp patterns when provided", () => {
|
2452
2382
|
const config = {
|
@@ -2595,13 +2525,9 @@ test.skip("handles alias for paths", () => {
|
|
2595
2525
|
};
|
2596
2526
|
expect(getStateFromPath("foo", config)).toEqual({
|
2597
2527
|
routes: [{ name: "Foo", path: "foo" }]
|
2598
|
-
}), expect(getPathFromState(getStateFromPath("foo", config), config)).toBe(
|
2599
|
-
"/foo"
|
2600
|
-
), expect(getStateFromPath("first", config)).toEqual({
|
2528
|
+
}), expect(getPathFromState(getStateFromPath("foo", config), config)).toBe("/foo"), expect(getStateFromPath("first", config)).toEqual({
|
2601
2529
|
routes: [{ name: "Foo", path: "first" }]
|
2602
|
-
}), expect(
|
2603
|
-
getPathFromState(getStateFromPath("first", config), config)
|
2604
|
-
).toBe("/foo"), expect(getStateFromPath("foo/baz/@$test", config)).toEqual({
|
2530
|
+
}), expect(getPathFromState(getStateFromPath("first", config), config)).toBe("/foo"), expect(getStateFromPath("foo/baz/@$test", config)).toEqual({
|
2605
2531
|
routes: [
|
2606
2532
|
{
|
2607
2533
|
name: "Foo",
|
@@ -2633,9 +2559,9 @@ test.skip("handles alias for paths", () => {
|
|
2633
2559
|
}
|
2634
2560
|
}
|
2635
2561
|
]
|
2636
|
-
}), expect(
|
2637
|
-
|
2638
|
-
)
|
2562
|
+
}), expect(getPathFromState(getStateFromPath("second/42", config), config)).toBe(
|
2563
|
+
"/foo/baz/42"
|
2564
|
+
), expect(getStateFromPath("foo/third", config)).toEqual({
|
2639
2565
|
routes: [
|
2640
2566
|
{
|
2641
2567
|
name: "Foo",
|
@@ -2649,9 +2575,9 @@ test.skip("handles alias for paths", () => {
|
|
2649
2575
|
}
|
2650
2576
|
}
|
2651
2577
|
]
|
2652
|
-
}), expect(
|
2653
|
-
|
2654
|
-
)
|
2578
|
+
}), expect(getPathFromState(getStateFromPath("foo/third", config), config)).toBe(
|
2579
|
+
"/foo/baz"
|
2580
|
+
), expect(getStateFromPath("foo/fourth/@$test", config)).toEqual({
|
2655
2581
|
routes: [
|
2656
2582
|
{
|
2657
2583
|
name: "Foo",
|
@@ -2667,10 +2593,7 @@ test.skip("handles alias for paths", () => {
|
|
2667
2593
|
}
|
2668
2594
|
]
|
2669
2595
|
}), expect(
|
2670
|
-
getPathFromState(
|
2671
|
-
getStateFromPath("foo/fourth/@$test", config),
|
2672
|
-
config
|
2673
|
-
)
|
2596
|
+
getPathFromState(getStateFromPath("foo/fourth/@$test", config), config)
|
2674
2597
|
).toBe("/foo/baz/@test"), expect(getStateFromPath("foo/qux/42", config)).toEqual({
|
2675
2598
|
routes: [
|
2676
2599
|
{
|
@@ -2686,9 +2609,9 @@ test.skip("handles alias for paths", () => {
|
|
2686
2609
|
}
|
2687
2610
|
}
|
2688
2611
|
]
|
2689
|
-
}), expect(
|
2690
|
-
|
2691
|
-
)
|
2612
|
+
}), expect(getPathFromState(getStateFromPath("foo/qux/42", config), config)).toBe(
|
2613
|
+
"/foo/qux/42"
|
2614
|
+
);
|
2692
2615
|
});
|
2693
2616
|
test.skip("throws if screen has alias but no path", () => {
|
2694
2617
|
expect(
|