@@ -18,6 +18,57 @@ import { setAngularAppEngineManifest } from '../src/manifest';
18
18
import { RenderMode } from '../src/routes/route-config' ;
19
19
import { setAngularAppTestingManifest } from './testing-utils' ;
20
20
21
+ function createEntryPoint ( locale : string ) {
22
+ return async ( ) => {
23
+ @Component ( {
24
+ standalone : true ,
25
+ selector : `app-ssr-${ locale } ` ,
26
+ template : `SSR works ${ locale . toUpperCase ( ) } ` ,
27
+ } )
28
+ class SSRComponent { }
29
+
30
+ @Component ( {
31
+ standalone : true ,
32
+ selector : `app-ssg-${ locale } ` ,
33
+ template : `SSG works ${ locale . toUpperCase ( ) } ` ,
34
+ } )
35
+ class SSGComponent { }
36
+
37
+ setAngularAppTestingManifest (
38
+ [
39
+ { path : 'ssg' , component : SSGComponent } ,
40
+ { path : 'ssr' , component : SSRComponent } ,
41
+ ] ,
42
+ [
43
+ { path : 'ssg' , renderMode : RenderMode . Prerender } ,
44
+ { path : '**' , renderMode : RenderMode . Server } ,
45
+ ] ,
46
+ '/' + locale ,
47
+ {
48
+ 'ssg/index.html' : {
49
+ size : 25 ,
50
+ hash : 'f799132d0a09e0fef93c68a12e443527700eb59e6f67fcb7854c3a60ff082fde' ,
51
+ text : async ( ) => `<html>
52
+ <head>
53
+ <title>SSG page</title>
54
+ <base href="/${ locale } " />
55
+ </head>
56
+ <body>
57
+ SSG works ${ locale . toUpperCase ( ) }
58
+ </body>
59
+ </html>
60
+ ` ,
61
+ } ,
62
+ } ,
63
+ ) ;
64
+
65
+ return {
66
+ ɵgetOrCreateAngularServerApp : getOrCreateAngularServerApp ,
67
+ ɵdestroyAngularServerApp : destroyAngularServerApp ,
68
+ } ;
69
+ } ;
70
+ }
71
+
21
72
describe ( 'AngularAppEngine' , ( ) => {
22
73
let appEngine : AngularAppEngine ;
23
74
@@ -28,59 +79,10 @@ describe('AngularAppEngine', () => {
28
79
setAngularAppEngineManifest ( {
29
80
// Note: Although we are testing only one locale, we need to configure two or more
30
81
// to ensure that we test a different code path.
31
- entryPoints : new Map (
32
- [ 'it' , 'en' ] . map ( ( locale ) => [
33
- locale ,
34
- async ( ) => {
35
- @Component ( {
36
- standalone : true ,
37
- selector : `app-ssr-${ locale } ` ,
38
- template : `SSR works ${ locale . toUpperCase ( ) } ` ,
39
- } )
40
- class SSRComponent { }
41
-
42
- @Component ( {
43
- standalone : true ,
44
- selector : `app-ssg-${ locale } ` ,
45
- template : `SSG works ${ locale . toUpperCase ( ) } ` ,
46
- } )
47
- class SSGComponent { }
48
-
49
- setAngularAppTestingManifest (
50
- [
51
- { path : 'ssg' , component : SSGComponent } ,
52
- { path : 'ssr' , component : SSRComponent } ,
53
- ] ,
54
- [
55
- { path : 'ssg' , renderMode : RenderMode . Prerender } ,
56
- { path : '**' , renderMode : RenderMode . Server } ,
57
- ] ,
58
- '/' + locale ,
59
- {
60
- 'ssg/index.html' : {
61
- size : 25 ,
62
- hash : 'f799132d0a09e0fef93c68a12e443527700eb59e6f67fcb7854c3a60ff082fde' ,
63
- text : async ( ) => `<html>
64
- <head>
65
- <title>SSG page</title>
66
- <base href="/${ locale } " />
67
- </head>
68
- <body>
69
- SSG works ${ locale . toUpperCase ( ) }
70
- </body>
71
- </html>
72
- ` ,
73
- } ,
74
- } ,
75
- ) ;
76
-
77
- return {
78
- ɵgetOrCreateAngularServerApp : getOrCreateAngularServerApp ,
79
- ɵdestroyAngularServerApp : destroyAngularServerApp ,
80
- } ;
81
- } ,
82
- ] ) ,
83
- ) ,
82
+ entryPoints : {
83
+ it : createEntryPoint ( 'it' ) ,
84
+ en : createEntryPoint ( 'en' ) ,
85
+ } ,
84
86
basePath : '' ,
85
87
} ) ;
86
88
@@ -143,29 +145,26 @@ describe('AngularAppEngine', () => {
143
145
destroyAngularServerApp ( ) ;
144
146
145
147
setAngularAppEngineManifest ( {
146
- entryPoints : new Map ( [
147
- [
148
- '' ,
149
- async ( ) => {
150
- @Component ( {
151
- standalone : true ,
152
- selector : 'app-home' ,
153
- template : `Home works` ,
154
- } )
155
- class HomeComponent { }
156
-
157
- setAngularAppTestingManifest (
158
- [ { path : 'home' , component : HomeComponent } ] ,
159
- [ { path : '**' , renderMode : RenderMode . Server } ] ,
160
- ) ;
161
-
162
- return {
163
- ɵgetOrCreateAngularServerApp : getOrCreateAngularServerApp ,
164
- ɵdestroyAngularServerApp : destroyAngularServerApp ,
165
- } ;
166
- } ,
167
- ] ,
168
- ] ) ,
148
+ entryPoints : {
149
+ '' : async ( ) => {
150
+ @Component ( {
151
+ standalone : true ,
152
+ selector : 'app-home' ,
153
+ template : `Home works` ,
154
+ } )
155
+ class HomeComponent { }
156
+
157
+ setAngularAppTestingManifest (
158
+ [ { path : 'home' , component : HomeComponent } ] ,
159
+ [ { path : '**' , renderMode : RenderMode . Server } ] ,
160
+ ) ;
161
+
162
+ return {
163
+ ɵgetOrCreateAngularServerApp : getOrCreateAngularServerApp ,
164
+ ɵdestroyAngularServerApp : destroyAngularServerApp ,
165
+ } ;
166
+ } ,
167
+ } ,
169
168
basePath : '' ,
170
169
} ) ;
171
170
0 commit comments