diff --git a/plugins/app-backend/src/service/appPlugin.test.ts b/plugins/app-backend/src/service/appPlugin.test.ts index bb5f92b536..fbb0747a64 100644 --- a/plugins/app-backend/src/service/appPlugin.test.ts +++ b/plugins/app-backend/src/service/appPlugin.test.ts @@ -93,34 +93,37 @@ describe('appPlugin', () => { ], }); - const rootContent = await fetch( - `http://localhost:${server.port()}?foo=bar`, - ).then(res => res.text()); - - expect(rootContent).toBe(` + const baseUrl = `http://localhost:${server.port()}`; + const withInjectedConfig = ` -`); +`; - const indexContent = await fetch( - `http://localhost:${server.port()}/index.html`, - ).then(res => res.text()); + await expect(fetch(`${baseUrl}`).then(res => res.text())).resolves.toBe( + withInjectedConfig, + ); - expect(indexContent).toBe(` - -`); + await expect( + fetch(`${baseUrl}?foo=bar`).then(res => res.text()), + ).resolves.toBe(withInjectedConfig); - const htmlContent = await fetch( - `http://localhost:${server.port()}/api/app/some/html5/route`, - ).then(res => res.text()); + await expect( + fetch(`${baseUrl}/index.html`).then(res => res.text()), + ).resolves.toBe(withInjectedConfig); - expect(htmlContent).toBe(` - -`); + await expect( + fetch(`${baseUrl}/index.html?foo=bar`).then(res => res.text()), + ).resolves.toBe(withInjectedConfig); + + await expect( + fetch(`${baseUrl}/api/app/some/html5/route`).then(res => res.text()), + ).resolves.toBe(withInjectedConfig); + + await expect( + fetch(`${baseUrl}/api/app/some/html5/route?foo=bar`).then(res => + res.text(), + ), + ).resolves.toBe(withInjectedConfig); }); });