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
@@ -63,8 +63,7 @@ test('converts state to path string with config', () => {
|
|
63
63
|
Baz: {
|
64
64
|
path: 'baz/:author',
|
65
65
|
parse: {
|
66
|
-
author: (author: string) =>
|
67
|
-
author.replace(/^\w/, (c) => c.toUpperCase()),
|
66
|
+
author: (author: string) => author.replace(/^\w/, (c) => c.toUpperCase()),
|
68
67
|
id: (id: string) => Number(id.replace(/^x/, '')),
|
69
68
|
valid: Boolean,
|
70
69
|
},
|
@@ -111,9 +110,9 @@ test('converts state to path string with config', () => {
|
|
111
110
|
}
|
112
111
|
|
113
112
|
expect(getPathFromState<object>(state, config)).toBe(path)
|
114
|
-
expect(
|
115
|
-
|
116
|
-
)
|
113
|
+
expect(getPathFromState<object>(getStateFromPath<object>(path, config) as State, config)).toBe(
|
114
|
+
path
|
115
|
+
)
|
117
116
|
})
|
118
117
|
|
119
118
|
test('prepends trailing slash to path', () => {
|
@@ -192,8 +191,7 @@ test('handles state with config with nested screens', () => {
|
|
192
191
|
Baz: {
|
193
192
|
path: 'baz/:author',
|
194
193
|
parse: {
|
195
|
-
author: (author: string) =>
|
196
|
-
author.replace(/^\w/, (c) => c.toUpperCase()),
|
194
|
+
author: (author: string) => author.replace(/^\w/, (c) => c.toUpperCase()),
|
197
195
|
count: Number,
|
198
196
|
valid: Boolean,
|
199
197
|
},
|
@@ -249,9 +247,9 @@ test('handles state with config with nested screens', () => {
|
|
249
247
|
}
|
250
248
|
|
251
249
|
expect(getPathFromState<object>(state, config)).toBe(path)
|
252
|
-
expect(
|
253
|
-
|
254
|
-
)
|
250
|
+
expect(getPathFromState<object>(getStateFromPath<object>(path, config) as State, config)).toBe(
|
251
|
+
path
|
252
|
+
)
|
255
253
|
})
|
256
254
|
|
257
255
|
test('handles state with config with nested screens and exact', () => {
|
@@ -271,8 +269,7 @@ test('handles state with config with nested screens and exact', () => {
|
|
271
269
|
Baz: {
|
272
270
|
path: 'baz/:author',
|
273
271
|
parse: {
|
274
|
-
author: (author: string) =>
|
275
|
-
author.replace(/^\w/, (c) => c.toUpperCase()),
|
272
|
+
author: (author: string) => author.replace(/^\w/, (c) => c.toUpperCase()),
|
276
273
|
count: Number,
|
277
274
|
valid: Boolean,
|
278
275
|
},
|
@@ -328,9 +325,9 @@ test('handles state with config with nested screens and exact', () => {
|
|
328
325
|
}
|
329
326
|
|
330
327
|
expect(getPathFromState<object>(state, config)).toBe(path)
|
331
|
-
expect(
|
332
|
-
|
333
|
-
)
|
328
|
+
expect(getPathFromState<object>(getStateFromPath<object>(path, config) as State, config)).toBe(
|
329
|
+
path
|
330
|
+
)
|
334
331
|
})
|
335
332
|
|
336
333
|
test('handles state with config with nested screens and unused configs', () => {
|
@@ -346,14 +343,12 @@ test('handles state with config with nested screens and unused configs', () => {
|
|
346
343
|
Baz: {
|
347
344
|
path: 'baz/:author',
|
348
345
|
parse: {
|
349
|
-
author: (author: string) =>
|
350
|
-
author.replace(/^\w/, (c) => c.toUpperCase()),
|
346
|
+
author: (author: string) => author.replace(/^\w/, (c) => c.toUpperCase()),
|
351
347
|
count: Number,
|
352
348
|
valid: Boolean,
|
353
349
|
},
|
354
350
|
stringify: {
|
355
|
-
author: (author: string) =>
|
356
|
-
author.replace(/^\w/, (c) => c.toLowerCase()),
|
351
|
+
author: (author: string) => author.replace(/^\w/, (c) => c.toLowerCase()),
|
357
352
|
unknown: (_: unknown) => 'x',
|
358
353
|
},
|
359
354
|
},
|
@@ -393,9 +388,9 @@ test('handles state with config with nested screens and unused configs', () => {
|
|
393
388
|
}
|
394
389
|
|
395
390
|
expect(getPathFromState<object>(state, config)).toBe(path)
|
396
|
-
expect(
|
397
|
-
|
398
|
-
)
|
391
|
+
expect(getPathFromState<object>(getStateFromPath<object>(path, config) as State, config)).toBe(
|
392
|
+
path
|
393
|
+
)
|
399
394
|
})
|
400
395
|
|
401
396
|
test('handles state with config with nested screens and unused configs with exact', () => {
|
@@ -412,14 +407,12 @@ test('handles state with config with nested screens and unused configs with exac
|
|
412
407
|
Baz: {
|
413
408
|
path: 'baz/:author',
|
414
409
|
parse: {
|
415
|
-
author: (author: string) =>
|
416
|
-
author.replace(/^\w/, (c) => c.toUpperCase()),
|
410
|
+
author: (author: string) => author.replace(/^\w/, (c) => c.toUpperCase()),
|
417
411
|
count: Number,
|
418
412
|
valid: Boolean,
|
419
413
|
},
|
420
414
|
stringify: {
|
421
|
-
author: (author: string) =>
|
422
|
-
author.replace(/^\w/, (c) => c.toLowerCase()),
|
415
|
+
author: (author: string) => author.replace(/^\w/, (c) => c.toLowerCase()),
|
423
416
|
unknown: (_: unknown) => 'x',
|
424
417
|
},
|
425
418
|
},
|
@@ -459,9 +452,9 @@ test('handles state with config with nested screens and unused configs with exac
|
|
459
452
|
}
|
460
453
|
|
461
454
|
expect(getPathFromState<object>(state, config)).toBe(path)
|
462
|
-
expect(
|
463
|
-
|
464
|
-
)
|
455
|
+
expect(getPathFromState<object>(getStateFromPath<object>(path, config) as State, config)).toBe(
|
456
|
+
path
|
457
|
+
)
|
465
458
|
})
|
466
459
|
|
467
460
|
test('handles nested object with stringify in it', () => {
|
@@ -483,12 +476,10 @@ test('handles nested object with stringify in it', () => {
|
|
483
476
|
Bis: {
|
484
477
|
path: 'bis/:author',
|
485
478
|
stringify: {
|
486
|
-
author: (author: string) =>
|
487
|
-
author.replace(/^\w/, (c) => c.toLowerCase()),
|
479
|
+
author: (author: string) => author.replace(/^\w/, (c) => c.toLowerCase()),
|
488
480
|
},
|
489
481
|
parse: {
|
490
|
-
author: (author: string) =>
|
491
|
-
author.replace(/^\w/, (c) => c.toUpperCase()),
|
482
|
+
author: (author: string) => author.replace(/^\w/, (c) => c.toUpperCase()),
|
492
483
|
count: Number,
|
493
484
|
valid: Boolean,
|
494
485
|
},
|
@@ -539,9 +530,9 @@ test('handles nested object with stringify in it', () => {
|
|
539
530
|
}
|
540
531
|
|
541
532
|
expect(getPathFromState<object>(state, config)).toBe(path)
|
542
|
-
expect(
|
543
|
-
|
544
|
-
)
|
533
|
+
expect(getPathFromState<object>(getStateFromPath<object>(path, config) as State, config)).toBe(
|
534
|
+
path
|
535
|
+
)
|
545
536
|
})
|
546
537
|
|
547
538
|
test('handles nested object with stringify in it with exact', () => {
|
@@ -565,12 +556,10 @@ test('handles nested object with stringify in it with exact', () => {
|
|
565
556
|
path: 'bis/:author',
|
566
557
|
exact: true,
|
567
558
|
stringify: {
|
568
|
-
author: (author: string) =>
|
569
|
-
author.replace(/^\w/, (c) => c.toLowerCase()),
|
559
|
+
author: (author: string) => author.replace(/^\w/, (c) => c.toLowerCase()),
|
570
560
|
},
|
571
561
|
parse: {
|
572
|
-
author: (author: string) =>
|
573
|
-
author.replace(/^\w/, (c) => c.toUpperCase()),
|
562
|
+
author: (author: string) => author.replace(/^\w/, (c) => c.toUpperCase()),
|
574
563
|
count: Number,
|
575
564
|
valid: Boolean,
|
576
565
|
},
|
@@ -621,9 +610,9 @@ test('handles nested object with stringify in it with exact', () => {
|
|
621
610
|
}
|
622
611
|
|
623
612
|
expect(getPathFromState<object>(state, config)).toBe(path)
|
624
|
-
expect(
|
625
|
-
|
626
|
-
)
|
613
|
+
expect(getPathFromState<object>(getStateFromPath<object>(path, config) as State, config)).toBe(
|
614
|
+
path
|
615
|
+
)
|
627
616
|
})
|
628
617
|
|
629
618
|
test('handles nested object for second route depth', () => {
|
@@ -664,9 +653,9 @@ test('handles nested object for second route depth', () => {
|
|
664
653
|
}
|
665
654
|
|
666
655
|
expect(getPathFromState<object>(state, config)).toBe(path)
|
667
|
-
expect(
|
668
|
-
|
669
|
-
)
|
656
|
+
expect(getPathFromState<object>(getStateFromPath<object>(path, config) as State, config)).toBe(
|
657
|
+
path
|
658
|
+
)
|
670
659
|
})
|
671
660
|
|
672
661
|
test('handles nested object for second route depth with exact', () => {
|
@@ -710,9 +699,9 @@ test('handles nested object for second route depth with exact', () => {
|
|
710
699
|
}
|
711
700
|
|
712
701
|
expect(getPathFromState<object>(state, config)).toBe(path)
|
713
|
-
expect(
|
714
|
-
|
715
|
-
)
|
702
|
+
expect(getPathFromState<object>(getStateFromPath<object>(path, config) as State, config)).toBe(
|
703
|
+
path
|
704
|
+
)
|
716
705
|
})
|
717
706
|
|
718
707
|
test('handles nested object for second route depth and path and stringify in roots', () => {
|
@@ -760,9 +749,9 @@ test('handles nested object for second route depth and path and stringify in roo
|
|
760
749
|
}
|
761
750
|
|
762
751
|
expect(getPathFromState<object>(state, config)).toBe(path)
|
763
|
-
expect(
|
764
|
-
|
765
|
-
)
|
752
|
+
expect(getPathFromState<object>(getStateFromPath<object>(path, config) as State, config)).toBe(
|
753
|
+
path
|
754
|
+
)
|
766
755
|
})
|
767
756
|
|
768
757
|
test('handles nested object for second route depth and path and stringify in roots with exact', () => {
|
@@ -815,9 +804,9 @@ test('handles nested object for second route depth and path and stringify in roo
|
|
815
804
|
}
|
816
805
|
|
817
806
|
expect(getPathFromState<object>(state, config)).toBe(path)
|
818
|
-
expect(
|
819
|
-
|
820
|
-
)
|
807
|
+
expect(getPathFromState<object>(getStateFromPath<object>(path, config) as State, config)).toBe(
|
808
|
+
path
|
809
|
+
)
|
821
810
|
})
|
822
811
|
|
823
812
|
test('ignores empty string paths', () => {
|
@@ -846,9 +835,9 @@ test('ignores empty string paths', () => {
|
|
846
835
|
}
|
847
836
|
|
848
837
|
expect(getPathFromState<object>(state, config)).toBe(path)
|
849
|
-
expect(
|
850
|
-
|
851
|
-
)
|
838
|
+
expect(getPathFromState<object>(getStateFromPath<object>(path, config) as State, config)).toBe(
|
839
|
+
path
|
840
|
+
)
|
852
841
|
})
|
853
842
|
|
854
843
|
test('keeps query params if path is empty', () => {
|
@@ -891,9 +880,9 @@ test('keeps query params if path is empty', () => {
|
|
891
880
|
}
|
892
881
|
|
893
882
|
expect(getPathFromState<object>(state, config)).toBe(path)
|
894
|
-
expect(
|
895
|
-
|
896
|
-
)
|
883
|
+
expect(getPathFromState<object>(getStateFromPath<object>(path, config) as State, config)).toEqual(
|
884
|
+
path
|
885
|
+
)
|
897
886
|
})
|
898
887
|
|
899
888
|
test('does not use Object.prototype properties as parsing functions', () => {
|
@@ -936,9 +925,9 @@ test('does not use Object.prototype properties as parsing functions', () => {
|
|
936
925
|
}
|
937
926
|
|
938
927
|
expect(getPathFromState<object>(state, config)).toBe(path)
|
939
|
-
expect(
|
940
|
-
|
941
|
-
)
|
928
|
+
expect(getPathFromState<object>(getStateFromPath<object>(path, config) as State, config)).toEqual(
|
929
|
+
path
|
930
|
+
)
|
942
931
|
})
|
943
932
|
|
944
933
|
test('cuts nested configs too', () => {
|
@@ -980,9 +969,9 @@ test('cuts nested configs too', () => {
|
|
980
969
|
}
|
981
970
|
|
982
971
|
expect(getPathFromState<object>(state, config)).toBe(path)
|
983
|
-
expect(
|
984
|
-
|
985
|
-
)
|
972
|
+
expect(getPathFromState<object>(getStateFromPath<object>(path, config) as State, config)).toBe(
|
973
|
+
path
|
974
|
+
)
|
986
975
|
})
|
987
976
|
|
988
977
|
test('cuts nested configs too with exact', () => {
|
@@ -1025,9 +1014,9 @@ test('cuts nested configs too with exact', () => {
|
|
1025
1014
|
}
|
1026
1015
|
|
1027
1016
|
expect(getPathFromState<object>(state, config)).toBe(path)
|
1028
|
-
expect(
|
1029
|
-
|
1030
|
-
)
|
1017
|
+
expect(getPathFromState<object>(getStateFromPath<object>(path, config) as State, config)).toBe(
|
1018
|
+
path
|
1019
|
+
)
|
1031
1020
|
})
|
1032
1021
|
|
1033
1022
|
test('handles empty path at the end', () => {
|
@@ -1063,9 +1052,9 @@ test('handles empty path at the end', () => {
|
|
1063
1052
|
}
|
1064
1053
|
|
1065
1054
|
expect(getPathFromState<object>(state, config)).toBe(path)
|
1066
|
-
expect(
|
1067
|
-
|
1068
|
-
)
|
1055
|
+
expect(getPathFromState<object>(getStateFromPath<object>(path, config) as State, config)).toBe(
|
1056
|
+
path
|
1057
|
+
)
|
1069
1058
|
})
|
1070
1059
|
|
1071
1060
|
test('returns "/" for empty path', () => {
|
@@ -1098,9 +1087,9 @@ test('returns "/" for empty path', () => {
|
|
1098
1087
|
}
|
1099
1088
|
|
1100
1089
|
expect(getPathFromState<object>(state, config)).toBe(path)
|
1101
|
-
expect(
|
1102
|
-
|
1103
|
-
)
|
1090
|
+
expect(getPathFromState<object>(getStateFromPath<object>(path, config) as State, config)).toBe(
|
1091
|
+
path
|
1092
|
+
)
|
1104
1093
|
})
|
1105
1094
|
|
1106
1095
|
test('parses no path specified', () => {
|
@@ -1128,9 +1117,9 @@ test('parses no path specified', () => {
|
|
1128
1117
|
}
|
1129
1118
|
|
1130
1119
|
expect(getPathFromState<object>(state, config)).toBe(path)
|
1131
|
-
expect(
|
1132
|
-
|
1133
|
-
)
|
1120
|
+
expect(getPathFromState<object>(getStateFromPath<object>(path, config) as State, config)).toBe(
|
1121
|
+
path
|
1122
|
+
)
|
1134
1123
|
})
|
1135
1124
|
|
1136
1125
|
test('strips undefined query params', () => {
|
@@ -1152,12 +1141,10 @@ test('strips undefined query params', () => {
|
|
1152
1141
|
Bis: {
|
1153
1142
|
path: 'bis/:author',
|
1154
1143
|
stringify: {
|
1155
|
-
author: (author: string) =>
|
1156
|
-
author.replace(/^\w/, (c) => c.toLowerCase()),
|
1144
|
+
author: (author: string) => author.replace(/^\w/, (c) => c.toLowerCase()),
|
1157
1145
|
},
|
1158
1146
|
parse: {
|
1159
|
-
author: (author: string) =>
|
1160
|
-
author.replace(/^\w/, (c) => c.toUpperCase()),
|
1147
|
+
author: (author: string) => author.replace(/^\w/, (c) => c.toUpperCase()),
|
1161
1148
|
count: Number,
|
1162
1149
|
valid: Boolean,
|
1163
1150
|
},
|
@@ -1207,9 +1194,9 @@ test('strips undefined query params', () => {
|
|
1207
1194
|
}
|
1208
1195
|
|
1209
1196
|
expect(getPathFromState<object>(state, config)).toBe(path)
|
1210
|
-
expect(
|
1211
|
-
|
1212
|
-
)
|
1197
|
+
expect(getPathFromState<object>(getStateFromPath<object>(path, config) as State, config)).toBe(
|
1198
|
+
path
|
1199
|
+
)
|
1213
1200
|
})
|
1214
1201
|
|
1215
1202
|
test('strips undefined query params with exact', () => {
|
@@ -1232,12 +1219,10 @@ test('strips undefined query params with exact', () => {
|
|
1232
1219
|
path: 'bis/:author',
|
1233
1220
|
exact: true,
|
1234
1221
|
stringify: {
|
1235
|
-
author: (author: string) =>
|
1236
|
-
author.replace(/^\w/, (c) => c.toLowerCase()),
|
1222
|
+
author: (author: string) => author.replace(/^\w/, (c) => c.toLowerCase()),
|
1237
1223
|
},
|
1238
1224
|
parse: {
|
1239
|
-
author: (author: string) =>
|
1240
|
-
author.replace(/^\w/, (c) => c.toUpperCase()),
|
1225
|
+
author: (author: string) => author.replace(/^\w/, (c) => c.toUpperCase()),
|
1241
1226
|
count: Number,
|
1242
1227
|
valid: Boolean,
|
1243
1228
|
},
|
@@ -1287,9 +1272,9 @@ test('strips undefined query params with exact', () => {
|
|
1287
1272
|
}
|
1288
1273
|
|
1289
1274
|
expect(getPathFromState<object>(state, config)).toBe(path)
|
1290
|
-
expect(
|
1291
|
-
|
1292
|
-
)
|
1275
|
+
expect(getPathFromState<object>(getStateFromPath<object>(path, config) as State, config)).toBe(
|
1276
|
+
path
|
1277
|
+
)
|
1293
1278
|
})
|
1294
1279
|
|
1295
1280
|
test('handles stripping all query params', () => {
|
@@ -1311,12 +1296,10 @@ test('handles stripping all query params', () => {
|
|
1311
1296
|
Bis: {
|
1312
1297
|
path: 'bis/:author',
|
1313
1298
|
stringify: {
|
1314
|
-
author: (author: string) =>
|
1315
|
-
author.replace(/^\w/, (c) => c.toLowerCase()),
|
1299
|
+
author: (author: string) => author.replace(/^\w/, (c) => c.toLowerCase()),
|
1316
1300
|
},
|
1317
1301
|
parse: {
|
1318
|
-
author: (author: string) =>
|
1319
|
-
author.replace(/^\w/, (c) => c.toUpperCase()),
|
1302
|
+
author: (author: string) => author.replace(/^\w/, (c) => c.toUpperCase()),
|
1320
1303
|
count: Number,
|
1321
1304
|
valid: Boolean,
|
1322
1305
|
},
|
@@ -1364,9 +1347,9 @@ test('handles stripping all query params', () => {
|
|
1364
1347
|
}
|
1365
1348
|
|
1366
1349
|
expect(getPathFromState<object>(state, config)).toBe(path)
|
1367
|
-
expect(
|
1368
|
-
|
1369
|
-
)
|
1350
|
+
expect(getPathFromState<object>(getStateFromPath<object>(path, config) as State, config)).toBe(
|
1351
|
+
path
|
1352
|
+
)
|
1370
1353
|
})
|
1371
1354
|
|
1372
1355
|
test('handles stripping all query params with exact', () => {
|
@@ -1390,12 +1373,10 @@ test('handles stripping all query params with exact', () => {
|
|
1390
1373
|
path: 'bis/:author',
|
1391
1374
|
exact: true,
|
1392
1375
|
stringify: {
|
1393
|
-
author: (author: string) =>
|
1394
|
-
author.replace(/^\w/, (c) => c.toLowerCase()),
|
1376
|
+
author: (author: string) => author.replace(/^\w/, (c) => c.toLowerCase()),
|
1395
1377
|
},
|
1396
1378
|
parse: {
|
1397
|
-
author: (author: string) =>
|
1398
|
-
author.replace(/^\w/, (c) => c.toUpperCase()),
|
1379
|
+
author: (author: string) => author.replace(/^\w/, (c) => c.toUpperCase()),
|
1399
1380
|
count: Number,
|
1400
1381
|
valid: Boolean,
|
1401
1382
|
},
|
@@ -1443,9 +1424,9 @@ test('handles stripping all query params with exact', () => {
|
|
1443
1424
|
}
|
1444
1425
|
|
1445
1426
|
expect(getPathFromState<object>(state, config)).toBe(path)
|
1446
|
-
expect(
|
1447
|
-
|
1448
|
-
)
|
1427
|
+
expect(getPathFromState<object>(getStateFromPath<object>(path, config) as State, config)).toBe(
|
1428
|
+
path
|
1429
|
+
)
|
1449
1430
|
})
|
1450
1431
|
|
1451
1432
|
test('replaces undefined query params', () => {
|
@@ -1466,9 +1447,9 @@ test('replaces undefined query params', () => {
|
|
1466
1447
|
}
|
1467
1448
|
|
1468
1449
|
expect(getPathFromState<object>(state, config)).toBe(path)
|
1469
|
-
expect(
|
1470
|
-
|
1471
|
-
)
|
1450
|
+
expect(getPathFromState<object>(getStateFromPath<object>(path, config) as State, config)).toBe(
|
1451
|
+
path
|
1452
|
+
)
|
1472
1453
|
})
|
1473
1454
|
|
1474
1455
|
// @modify: TODO: temporally disable failing test
|
@@ -1492,9 +1473,9 @@ test.skip('matches wildcard patterns at root', () => {
|
|
1492
1473
|
}
|
1493
1474
|
|
1494
1475
|
expect(getPathFromState<object>(state, config)).toBe('/404')
|
1495
|
-
expect(
|
1496
|
-
|
1497
|
-
)
|
1476
|
+
expect(getPathFromState<object>(getStateFromPath<object>(path, config) as State, config)).toBe(
|
1477
|
+
'/404'
|
1478
|
+
)
|
1498
1479
|
})
|
1499
1480
|
|
1500
1481
|
// @modify: TODO: temporally disable failing test
|
@@ -1535,9 +1516,9 @@ test.skip('matches wildcard patterns at nested level', () => {
|
|
1535
1516
|
}
|
1536
1517
|
|
1537
1518
|
expect(getPathFromState<object>(state, config)).toBe('/bar/42/404')
|
1538
|
-
expect(
|
1539
|
-
|
1540
|
-
)
|
1519
|
+
expect(getPathFromState<object>(getStateFromPath<object>(path, config) as State, config)).toBe(
|
1520
|
+
'/bar/42/404'
|
1521
|
+
)
|
1541
1522
|
})
|
1542
1523
|
|
1543
1524
|
// @modify: TODO: temporally disable failing test
|
@@ -1581,9 +1562,9 @@ test.skip('matches wildcard patterns at nested level with exact', () => {
|
|
1581
1562
|
}
|
1582
1563
|
|
1583
1564
|
expect(getPathFromState<object>(state, config)).toBe('/404')
|
1584
|
-
expect(
|
1585
|
-
|
1586
|
-
)
|
1565
|
+
expect(getPathFromState<object>(getStateFromPath<object>(path, config) as State, config)).toBe(
|
1566
|
+
'/404'
|
1567
|
+
)
|
1587
1568
|
})
|
1588
1569
|
|
1589
1570
|
test('tries to match wildcard patterns at the end', () => {
|
@@ -1624,9 +1605,9 @@ test('tries to match wildcard patterns at the end', () => {
|
|
1624
1605
|
}
|
1625
1606
|
|
1626
1607
|
expect(getPathFromState<object>(state, config)).toBe(path)
|
1627
|
-
expect(
|
1628
|
-
|
1629
|
-
)
|
1608
|
+
expect(getPathFromState<object>(getStateFromPath<object>(path, config) as State, config)).toBe(
|
1609
|
+
path
|
1610
|
+
)
|
1630
1611
|
})
|
1631
1612
|
|
1632
1613
|
// @modify: TODO: temporally disable failing test
|
@@ -1660,9 +1641,9 @@ test.skip('uses nearest parent wildcard match for unmatched paths', () => {
|
|
1660
1641
|
}
|
1661
1642
|
|
1662
1643
|
expect(getPathFromState<object>(state, config)).toBe('/404')
|
1663
|
-
expect(
|
1664
|
-
|
1665
|
-
)
|
1644
|
+
expect(getPathFromState<object>(getStateFromPath<object>(path, config) as State, config)).toBe(
|
1645
|
+
'/404'
|
1646
|
+
)
|
1666
1647
|
})
|
1667
1648
|
|
1668
1649
|
// @modify: TODO: temporally disable failing test
|
@@ -1696,9 +1677,7 @@ test.skip('handles path at top level', () => {
|
|
1696
1677
|
}
|
1697
1678
|
|
1698
1679
|
expect(getPathFromState<object>(state, config)).toBe(`/${path}`)
|
1699
|
-
expect(getPathFromState<object>(getStateFromPath<object>(path, config)!, config)).toBe(
|
1700
|
-
`/${path}`
|
1701
|
-
)
|
1680
|
+
expect(getPathFromState<object>(getStateFromPath<object>(path, config)!, config)).toBe(`/${path}`)
|
1702
1681
|
})
|
1703
1682
|
|
1704
1683
|
// @modify: TODO: temporally disable failing test
|