BRM-104: тест BRM-87 задаёт адрес сам, а не берёт из окружения
All checks were successful
peppa/lint lint: success за 0с
peppa/test test: success за 3с
ci / checks (pull_request) Successful in 10s
deploy / deploy (pull_request) Successful in 28s

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Peppa 2026-11-17 22:39:25 +05:00
parent 6da1eb6b29
commit 993be21ba8

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>/);
});