From 748ef172f6378a9a056d5416ee7f389ce06b3fc5 Mon Sep 17 00:00:00 2001 From: daniluk4000 Date: Mon, 4 Nov 2024 15:31:23 +0300 Subject: [PATCH] chore: fix test fomratting --- test/tests.ts | 45 +++++++++++++-------------------------------- 1 file changed, 13 insertions(+), 32 deletions(-) diff --git a/test/tests.ts b/test/tests.ts index 8a08bdfc92..ba84a26d26 100644 --- a/test/tests.ts +++ b/test/tests.ts @@ -310,38 +310,19 @@ export function testNitro( expect(data).toMatch("

Hello JSX!

"); }); - it.skipIf( - ctx.preset.startsWith("cloudflare") || ctx.preset === "vercel-edge" - )("handles custom Vary header", async () => { - let headers = ( - await callHandler({ - url: "/foo.css", - headers: { "Accept-Encoding": "gzip" }, - }) - ).headers; - if (headers["vary"]) - expect( - headers["vary"].includes("Origin") && - headers["vary"].includes("Accept-Encoding") - ).toBeTruthy(); - - headers = ( - await callHandler({ url: "/foo.css", headers: { "Accept-Encoding": "" } }) - ).headers; - if (headers["vary"]) expect(headers["vary"]).toBe("Origin"); - - headers = ( - await callHandler({ - url: "/foo.js", - headers: { "Accept-Encoding": "gzip" }, - }) - ).headers; - if (headers["vary"]) - expect( - headers["vary"].includes("Origin") && - headers["vary"].includes("Accept-Encoding") - ).toBeTruthy(); - }); + it.skipIf(ctx.preset.startsWith('cloudflare') || ctx.preset === 'vercel-edge')( + "handles custom Vary header", + async () => { + let headers = (await callHandler({ url: "/foo.css", headers: { "Accept-Encoding": "gzip" } })).headers; + if (headers["vary"]) expect(headers["vary"].includes('Origin') && headers["vary"].includes('Accept-Encoding')).toBeTruthy(); + + headers = (await callHandler({ url: "/foo.css", headers: { "Accept-Encoding": "" } })).headers; + if (headers["vary"]) expect(headers["vary"]).toBe("Origin"); + + headers = (await callHandler({ url: "/foo.js", headers: { "Accept-Encoding": "gzip" } })).headers; + if (headers["vary"]) expect(headers["vary"].includes('Origin') && headers["vary"].includes('Accept-Encoding')).toBeTruthy(); + } + ); it("handles route rules - headers", async () => { const { headers } = await callHandler({ url: "/rules/headers" });