Refresh HiveGrid Cloud reference snapshot
This commit is contained in:
1 parent
5e99e14772
commit
7f88026f79
5955 files changed
+1177325
-188362
No files matched your search
+24
@@ -0,0 +1,24 @@
|
||||
// @vitest-environment jsdom
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { getCurrentDocumentCspNonce } from "./documentCspNonce";
|
||||
|
||||
describe("document CSP nonce", () => {
|
||||
it("reads the browser nonce property from a trusted document script", () => {
|
||||
const script = document.createElement("script");
|
||||
script.nonce = "aBcDeFgHiJkLmNoPqRsTuVwX";
|
||||
document.head.appendChild(script);
|
||||
|
||||
expect(getCurrentDocumentCspNonce(document)).toBe(script.nonce);
|
||||
script.remove();
|
||||
});
|
||||
|
||||
it("ignores malformed nonce attributes", () => {
|
||||
const script = document.createElement("script");
|
||||
script.nonce = "spoofed";
|
||||
document.head.appendChild(script);
|
||||
|
||||
expect(getCurrentDocumentCspNonce(document)).toBeUndefined();
|
||||
script.remove();
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user