diff --git a/tests/server.test.ts b/tests/server.test.ts index 2ef3a1a..36fd2a1 100644 --- a/tests/server.test.ts +++ b/tests/server.test.ts @@ -403,5 +403,29 @@ describe.each(["development", "production"] as const)( expect(response.text).toMatch(/

subpath<\/h1>/); }); }); + + describe.runIf(mode === "production")( + "App with custom static options", + async () => { + const app = express(); + + beforeAll(async () => { + process.chdir(path.join(__dirname, "envs/basic")); + + ViteExpress.static({ maxAge: "1h" }); + + await new Promise((done) => { + ViteExpress.listen(app, 0, async () => done()); + }); + }); + + test("static files have custom options", async () => { + const response = await request(app).get("/test.txt"); + expect(response.headers["cache-control"]).toBe( + "public, max-age=3600", + ); + }); + }, + ); }, );