|
| 1 | +import { testDynamicSegments } from 'e2e-shared/specs/dynamic-segments.cy' |
| 2 | + |
| 3 | +testDynamicSegments({ |
| 4 | + path: '/app/dynamic-segments/dynamic/segment', |
| 5 | + expectedSegments: ['segment'], |
| 6 | + nextJsRouter: 'app' |
| 7 | +}) |
| 8 | + |
| 9 | +testDynamicSegments({ |
| 10 | + path: '/pages/dynamic-segments/dynamic/segment', |
| 11 | + expectedSegments: ['segment'], |
| 12 | + nextJsRouter: 'pages' |
| 13 | +}) |
| 14 | + |
| 15 | +// Catch-all -- |
| 16 | + |
| 17 | +testDynamicSegments({ |
| 18 | + path: '/app/dynamic-segments/catch-all/foo', |
| 19 | + expectedSegments: ['foo'], |
| 20 | + nextJsRouter: 'app' |
| 21 | +}) |
| 22 | + |
| 23 | +testDynamicSegments({ |
| 24 | + path: '/pages/dynamic-segments/catch-all/foo', |
| 25 | + expectedSegments: ['foo'], |
| 26 | + nextJsRouter: 'pages' |
| 27 | +}) |
| 28 | + |
| 29 | +testDynamicSegments({ |
| 30 | + path: '/app/dynamic-segments/catch-all/a/b/c', |
| 31 | + expectedSegments: ['a', 'b', 'c'], |
| 32 | + nextJsRouter: 'app' |
| 33 | +}) |
| 34 | + |
| 35 | +testDynamicSegments({ |
| 36 | + path: '/pages/dynamic-segments/catch-all/a/b/c', |
| 37 | + expectedSegments: ['a', 'b', 'c'], |
| 38 | + nextJsRouter: 'pages' |
| 39 | +}) |
| 40 | + |
| 41 | +// Optional catch-all -- |
| 42 | + |
| 43 | +testDynamicSegments({ |
| 44 | + path: '/app/dynamic-segments/optional-catch-all', // no segments |
| 45 | + expectedSegments: [], |
| 46 | + nextJsRouter: 'app' |
| 47 | +}) |
| 48 | + |
| 49 | +testDynamicSegments({ |
| 50 | + path: '/pages/dynamic-segments/optional-catch-all', // no segments |
| 51 | + expectedSegments: [], |
| 52 | + nextJsRouter: 'pages' |
| 53 | +}) |
| 54 | + |
| 55 | +testDynamicSegments({ |
| 56 | + path: '/app/dynamic-segments/optional-catch-all/foo', |
| 57 | + expectedSegments: ['foo'], |
| 58 | + nextJsRouter: 'app' |
| 59 | +}) |
| 60 | + |
| 61 | +testDynamicSegments({ |
| 62 | + path: '/pages/dynamic-segments/optional-catch-all/foo', |
| 63 | + expectedSegments: ['foo'], |
| 64 | + nextJsRouter: 'pages' |
| 65 | +}) |
| 66 | + |
| 67 | +testDynamicSegments({ |
| 68 | + path: '/app/dynamic-segments/optional-catch-all/a/b/c', |
| 69 | + expectedSegments: ['a', 'b', 'c'], |
| 70 | + nextJsRouter: 'app' |
| 71 | +}) |
| 72 | + |
| 73 | +testDynamicSegments({ |
| 74 | + path: '/pages/dynamic-segments/optional-catch-all/a/b/c', |
| 75 | + expectedSegments: ['a', 'b', 'c'], |
| 76 | + nextJsRouter: 'pages' |
| 77 | +}) |
0 commit comments