fix: constrain PWA caching and extend font CSP
Quality / quality (ubuntu-latest) (push) Failing after 22s
Quality / quality (windows-latest) (push) Canceled after 0s

This commit is contained in:
2026-08-03 00:38:23 +05:30
parent b3e9b99e13
commit 649e3d9127
4 changed files with 47 additions and 3 deletions
+32
View File
@@ -196,6 +196,38 @@ test("loadAppConfig loads env before evaluating the config module", async () =>
}
});
test("Google Fonts CSP supports direct fonts and service-worker fetches", async () => {
const dir = mkdtempSync(join(tmpdir(), "wrnexus-font-csp-"));
try {
writeFileSync(
join(dir, "wrnexus.config.ts"),
`export default {
fonts: { google: [{ family: "Inter" }] },
security: {
contentSecurityPolicy: {
directives: { "connect-src": ["'self'", "https://api.example.com"] }
}
}
};\n`,
);
const config = await loadAppConfig(dir, "production");
const directives =
config.security?.contentSecurityPolicy === false
? undefined
: config.security?.contentSecurityPolicy?.directives;
expect(directives?.["style-src"]).toContain("https://fonts.googleapis.com");
expect(directives?.["font-src"]).toContain("https://fonts.gstatic.com");
expect(directives?.["connect-src"]).toEqual([
"'self'",
"https://api.example.com",
"https://fonts.gstatic.com",
]);
} finally {
rmSync(dir, { recursive: true, force: true });
}
});
test("package-aware styles add relative imports and Tailwind scan sources", async () => {
const root = mkdtempSync(join(tmpdir(), "wrnexus-styles-"));
try {