Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Nov 7, 2024
1 parent d3ef452 commit 0f50bf1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/fixture/nitro.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ export default defineNitroConfig({
"/rules/_/cached/noncached": { cache: false, swr: false, isr: false },
"/rules/_/cached/**": { swr: true },
"/api/proxy/**": { proxy: "/api/echo" },
"/build/**": { headers: { "x-build-header": "works" } },
},
prerender: {
crawlLinks: true,
Expand Down
16 changes: 16 additions & 0 deletions test/presets/nitro-dev.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,22 @@ describe.skipIf(isCI)("nitro:preset:nitro-dev", async () => {
expect(data.keys).includes("src:nitro.config.ts");
});

it("static asset headers", async () => {
const { headers } = await ctx.fetch("/build/test.txt");
expect(Object.fromEntries(headers)).toMatchObject({
"accept-ranges": "bytes",
"cache-control": "public, max-age=0",
"last-modified": expect.any(String),
etag: 'W/"7-18df5a508c5"',
"content-type": "text/plain; charset=UTF-8",
"content-length": "7",
date: expect.any(String),
connection: "keep-alive",
"keep-alive": "timeout=5",
"x-build-header": "works",
});
});

describe("openAPI", () => {
let spec: OpenAPI3;
it("/_openapi.json", async () => {
Expand Down

0 comments on commit 0f50bf1

Please sign in to comment.