Skip to content

Commit

Permalink
chore: fix test fomratting
Browse files Browse the repository at this point in the history
  • Loading branch information
daniluk4000 committed Nov 4, 2024
1 parent 0e49e1a commit 748ef17
Showing 1 changed file with 13 additions and 32 deletions.
45 changes: 13 additions & 32 deletions test/tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -310,38 +310,19 @@ export function testNitro(
expect(data).toMatch("<h1 >Hello JSX!</h1>");
});

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" });
Expand Down

0 comments on commit 748ef17

Please sign in to comment.