tazakazahstan/test/product-page.test.ts
Peppa 41be6bc36a
Some checks failed
peppa/lint lint: success за 1с
peppa/typecheck typecheck: success за 1с
peppa/test test: success за 0с
peppa/build build: success за 1с
ci / checks (pull_request) Successful in 10s
deploy / deploy (pull_request) Failing after 2m18s
TZK-3: страница продукта на / и выкладка по шаблону Пеппы
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-16 10:50:14 +05:00

32 lines
1.1 KiB
TypeScript

import assert from "node:assert/strict";
import { after, before, describe, test } from "node:test";
import { startTestApp, type TestApp } from "./helpers.ts";
describe("product-page", () => {
let app: TestApp;
before(async () => {
app = await startTestApp();
});
after(() => app.close());
const get = async (path: string) => {
const r = await fetch(app.baseUrl + path);
return { r, text: await r.text() };
};
test("Scenario: Открытие страницы", async () => {
const { r, text } = await get("/");
assert.equal(r.status, 200);
assert.match(r.headers.get("content-type") ?? "", /text\/html/);
assert.match(text, /Таза Қазақстан/);
assert.match(text, /Что уже работает/);
});
test("Scenario: Выбор языка", async () => {
const { text } = await get("/?lang=kk");
assert.match(text, /Қазір не жұмыс істейді/);
});
test("Scenario: Неизвестный язык", async () => {
const { text } = await get("/?lang=xx");
assert.match(text, /Что уже работает/);
});
});