All checks were successful
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
42 lines
1.5 KiB
TypeScript
42 lines
1.5 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { buildApp } from "../src/app.ts";
|
|
|
|
describe("Requirement: Политика конфиденциальности и оферта", () => {
|
|
it("Scenario: Открытие политики", async () => {
|
|
const app = await buildApp();
|
|
const res = await app.inject("/legal/privacy");
|
|
expect(res.statusCode).toBe(200);
|
|
expect(res.headers["content-type"]).toContain("text/html");
|
|
expect(res.body).toContain("Черновик");
|
|
expect(res.body).toContain("обезличивание");
|
|
await app.close();
|
|
});
|
|
|
|
it("Scenario: Открытие оферты", async () => {
|
|
const app = await buildApp();
|
|
const res = await app.inject("/legal/offer");
|
|
expect(res.statusCode).toBe(200);
|
|
expect(res.headers["content-type"]).toContain("text/html");
|
|
expect(res.body).toContain("Черновик");
|
|
await app.close();
|
|
});
|
|
|
|
it("Scenario: Ссылки на главной", async () => {
|
|
const app = await buildApp();
|
|
const body = (await app.inject("/")).body;
|
|
expect(body).toContain('href="/legal/privacy"');
|
|
expect(body).toContain('href="/legal/offer"');
|
|
await app.close();
|
|
});
|
|
|
|
it("Scenario: Неизвестная страница", async () => {
|
|
const app = await buildApp();
|
|
for (const p of ["/legal/unknown", "/legal/constructor", "/legal/__proto__"]) {
|
|
const res = await app.inject(p);
|
|
expect(res.statusCode).toBe(404);
|
|
expect(res.json()).toEqual({ error: "not_found" });
|
|
}
|
|
await app.close();
|
|
});
|
|
});
|