@@ -93,34 +93,37 @@ describe('appPlugin', () => {
9393 ] ,
9494 } ) ;
9595
96- const rootContent = await fetch ( `http://localhost:${ server . port ( ) } ` ) . then (
97- res => res . text ( ) ,
98- ) ;
99-
100- expect ( rootContent ) . toBe ( `<html><head>
96+ const baseUrl = `http://localhost:${ server . port ( ) } ` ;
97+ const withInjectedConfig = `<html><head>
10198<script type="backstage.io/config">
10299[]
103100</script>
104- </head></html>` ) ;
101+ </head></html>` ;
105102
106- const indexContent = await fetch (
107- `http://localhost: ${ server . port ( ) } /index.html` ,
108- ) . then ( res => res . text ( ) ) ;
103+ await expect ( fetch ( ` ${ baseUrl } ` ) . then ( res => res . text ( ) ) ) . resolves . toBe (
104+ withInjectedConfig ,
105+ ) ;
109106
110- expect ( indexContent ) . toBe ( `<html><head>
111- <script type="backstage.io/config">
112- []
113- </script>
114- </head></html>` ) ;
107+ await expect (
108+ fetch ( `${ baseUrl } ?foo=bar` ) . then ( res => res . text ( ) ) ,
109+ ) . resolves . toBe ( withInjectedConfig ) ;
115110
116- const htmlContent = await fetch (
117- `http://localhost: ${ server . port ( ) } /api/app/some/html5/route` ,
118- ) . then ( res => res . text ( ) ) ;
111+ await expect (
112+ fetch ( ` ${ baseUrl } /index.html` ) . then ( res => res . text ( ) ) ,
113+ ) . resolves . toBe ( withInjectedConfig ) ;
119114
120- expect ( htmlContent ) . toBe ( `<html><head>
121- <script type="backstage.io/config">
122- []
123- </script>
124- </head></html>` ) ;
115+ await expect (
116+ fetch ( `${ baseUrl } /index.html?foo=bar` ) . then ( res => res . text ( ) ) ,
117+ ) . resolves . toBe ( withInjectedConfig ) ;
118+
119+ await expect (
120+ fetch ( `${ baseUrl } /api/app/some/html5/route` ) . then ( res => res . text ( ) ) ,
121+ ) . resolves . toBe ( withInjectedConfig ) ;
122+
123+ await expect (
124+ fetch ( `${ baseUrl } /api/app/some/html5/route?foo=bar` ) . then ( res =>
125+ res . text ( ) ,
126+ ) ,
127+ ) . resolves . toBe ( withInjectedConfig ) ;
125128 } ) ;
126129} ) ;
0 commit comments