diff --git a/test/site-mail.test.js b/test/site-mail.test.js index f1b5ca3..1fa0213 100644 --- a/test/site-mail.test.js +++ b/test/site-mail.test.js @@ -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>/); - } + 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>/); });