@@ -66,24 +66,6 @@ describe('extractRoutesAndCreateRouteTree', () => {
66
66
) ;
67
67
} ) ;
68
68
69
- it ( 'should handle route not matching server routing configuration' , async ( ) => {
70
- setAngularAppTestingManifest (
71
- [
72
- { path : 'home' , component : DummyComponent } ,
73
- { path : 'about' , component : DummyComponent } , // This route is not in the server configuration
74
- ] ,
75
- [
76
- { path : 'home' , renderMode : RenderMode . Client } ,
77
- // 'about' route is missing here
78
- ] ,
79
- ) ;
80
-
81
- const { errors } = await extractRoutesAndCreateRouteTree ( url ) ;
82
- expect ( errors [ 0 ] ) . toContain (
83
- `The '/about' route does not match any route defined in the server routing configuration.` ,
84
- ) ;
85
- } ) ;
86
-
87
69
describe ( 'when `invokeGetPrerenderParams` is true' , ( ) => {
88
70
it ( 'should resolve parameterized routes for SSG and add a fallback route if fallback is Server' , async ( ) => {
89
71
setAngularAppTestingManifest (
@@ -294,4 +276,67 @@ describe('extractRoutesAndCreateRouteTree', () => {
294
276
{ route : '/user/:id/role/:role' , renderMode : RenderMode . Client } ,
295
277
] ) ;
296
278
} ) ;
279
+
280
+ it ( `should not error when a catch-all route didn't match any Angular route.` , async ( ) => {
281
+ setAngularAppTestingManifest (
282
+ [ { path : 'home' , component : DummyComponent } ] ,
283
+ [
284
+ { path : 'home' , renderMode : RenderMode . Server } ,
285
+ { path : '**' , renderMode : RenderMode . Server } ,
286
+ ] ,
287
+ ) ;
288
+
289
+ const { errors } = await extractRoutesAndCreateRouteTree (
290
+ url ,
291
+ /** manifest */ undefined ,
292
+ /** invokeGetPrerenderParams */ false ,
293
+ /** includePrerenderFallbackRoutes */ false ,
294
+ ) ;
295
+
296
+ expect ( errors ) . toHaveSize ( 0 ) ;
297
+ } ) ;
298
+
299
+ it ( 'should error when a route is not defined in the server routing configuration' , async ( ) => {
300
+ setAngularAppTestingManifest (
301
+ [ { path : 'home' , component : DummyComponent } ] ,
302
+ [
303
+ { path : 'home' , renderMode : RenderMode . Server } ,
304
+ { path : 'invalid' , renderMode : RenderMode . Server } ,
305
+ ] ,
306
+ ) ;
307
+
308
+ const { errors } = await extractRoutesAndCreateRouteTree (
309
+ url ,
310
+ /** manifest */ undefined ,
311
+ /** invokeGetPrerenderParams */ false ,
312
+ /** includePrerenderFallbackRoutes */ false ,
313
+ ) ;
314
+
315
+ expect ( errors ) . toHaveSize ( 1 ) ;
316
+ expect ( errors [ 0 ] ) . toContain (
317
+ `The server route 'invalid' does not match any routes defined in the Angular routing configuration` ,
318
+ ) ;
319
+ } ) ;
320
+
321
+ it ( 'should error when a server route is not defined in the Angular routing configuration' , async ( ) => {
322
+ setAngularAppTestingManifest (
323
+ [
324
+ { path : 'home' , component : DummyComponent } ,
325
+ { path : 'invalid' , component : DummyComponent } ,
326
+ ] ,
327
+ [ { path : 'home' , renderMode : RenderMode . Server } ] ,
328
+ ) ;
329
+
330
+ const { errors } = await extractRoutesAndCreateRouteTree (
331
+ url ,
332
+ /** manifest */ undefined ,
333
+ /** invokeGetPrerenderParams */ false ,
334
+ /** includePrerenderFallbackRoutes */ false ,
335
+ ) ;
336
+
337
+ expect ( errors ) . toHaveSize ( 1 ) ;
338
+ expect ( errors [ 0 ] ) . toContain (
339
+ `The 'invalid' route does not match any route defined in the server routing configuration` ,
340
+ ) ;
341
+ } ) ;
297
342
} ) ;
0 commit comments