BRM-104: без адреса — другой способ связаться, понятный итог по регионам #100

Merged
peppa-bot merged 3 commits from task/brm-104 into main 2026-11-17 22:45:55 +05:00
Showing only changes of commit 993be21ba8 - Show all commits

View File

@ -1,10 +1,11 @@
import test from "node:test";
import assert from "node:assert/strict";
import { pageHtml } from "../src/site.js";
import { execFileSync } from "node:child_process";
// BRM-104: адрес задаётся явно — без CONTACT_EMAIL ссылки на почту нет вовсе (test/contact.test.js).
test("BRM-87: адрес на «Рынке» и главной не прячется от посетителя", () => {
for (const f of ["market.html"]) {
const h = pageHtml(f, "ru");
assert.match(h, /<a href="mailto:[^"@]+%40[^"@]+">[^<@]+&#64;[^<@]+<\/a>/);
}
const h = execFileSync(process.execPath, ["--input-type=module", "-e",
`import { homePage, pageHtml } from "./src/site.js"; process.stdout.write(JSON.stringify([pageHtml("market.html", "ru"), homePage("ru")]));`],
{ env: { PATH: process.env.PATH, CONTACT_EMAIL: "hello@brand.example" }, encoding: "utf8" });
for (const page of JSON.parse(h)) assert.match(page, /<a href="mailto:[^"@]+%40[^"@]+">[^<@]+&#64;[^<@]+<\/a>/);
});