diff --git a/index.html b/index.html index c6a0f11d1..ebb12432d 100644 --- a/index.html +++ b/index.html @@ -56,7 +56,6 @@ ", + "utf8", + ); + + process.env.GIT_COMMIT = "first"; + const first = await getAppShellContent(htmlPath); + + process.env.GIT_COMMIT = "second"; + const second = await getAppShellContent(htmlPath); + + expect(first).toContain('"first"'); + expect(second).toBe(first); + expect(second).not.toContain('"second"'); + }); + + test("sets shared-cache headers for the app shell", () => { + const headers = new Map(); + const response = { + setHeader(name: string, value: string) { + headers.set(name, value); + }, + } as any; + + setAppShellCacheHeaders(response); + + expect(headers.get("Cache-Control")).toBe( + "public, max-age=0, s-maxage=300, stale-while-revalidate=86400", + ); + expect(headers.get("Content-Type")).toBe("text/html"); + }); +}); diff --git a/vite.config.ts b/vite.config.ts index eefc073c2..e53544896 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -101,7 +101,6 @@ export default defineConfig(({ mode }) => { inject: { data: { gitCommit: JSON.stringify("DEV"), - instanceId: JSON.stringify("DEV_ID"), ...htmlAssetData, }, },