feat(confidence-engine): add tester legal pages
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
import React from "react";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { renderToStaticMarkup } from "react-dom/server";
|
||||
import { NextRequest } from "next/server";
|
||||
import PrivacyPage from "@/app/privacy/page.jsx";
|
||||
import TermsPage from "@/app/terms/page.jsx";
|
||||
import CookiesPage from "@/app/cookies/page.jsx";
|
||||
import LegalNavigation from "@/components/legal-navigation.jsx";
|
||||
import { middleware } from "@/middleware.js";
|
||||
|
||||
describe("public legal pages", () => {
|
||||
it.each([
|
||||
["Privacy Policy", PrivacyPage],
|
||||
["Terms of Use", TermsPage],
|
||||
["Cookie Policy", CookiesPage],
|
||||
])("renders the %s heading", (heading, Page) => {
|
||||
const html = renderToStaticMarkup(<Page />);
|
||||
expect(html).toContain(`<h1 class="text-3xl font-bold tracking-tight text-teal-700">${heading}</h1>`);
|
||||
});
|
||||
|
||||
it("exposes all public legal links without cookie consent controls", () => {
|
||||
const html = renderToStaticMarkup(<LegalNavigation />);
|
||||
expect(html).toContain('href="/privacy"');
|
||||
expect(html).toContain('href="/terms"');
|
||||
expect(html).toContain('href="/cookies"');
|
||||
expect(html).not.toMatch(/Accept cookies|Reject cookies/i);
|
||||
});
|
||||
|
||||
it.each(["privacy", "terms", "cookies"])("keeps /%s public", async (path) => {
|
||||
const response = await middleware(new NextRequest(`http://localhost:3000/${path}`));
|
||||
expect(response.status).toBe(200);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user