-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproxy.test.ts
More file actions
18 lines (15 loc) · 761 Bytes
/
Copy pathproxy.test.ts
File metadata and controls
18 lines (15 loc) · 761 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import { NextRequest } from "next/server"
import { describe, expect, it } from "vitest"
import { proxy } from "./proxy"
describe("status page proxy", () => {
it("sets a fresh strict CSP for status page rendering", () => {
const first = proxy(new NextRequest("https://pulse.test/status"))
const second = proxy(new NextRequest("https://pulse.test/status/group"))
const firstPolicy = first.headers.get("Content-Security-Policy")
const secondPolicy = second.headers.get("Content-Security-Policy")
expect(firstPolicy).toContain("script-src 'self' 'nonce-")
expect(firstPolicy).toContain("'strict-dynamic'")
expect(firstPolicy).not.toContain("script-src 'self' 'unsafe-inline'")
expect(secondPolicy).not.toBe(firstPolicy)
})
})