// BRM-146: матрица каналов, путь через согласование, пакет для ручной публикации, публичная отправка выключена. import test from "node:test"; import assert from "node:assert/strict"; import fs from "node:fs"; import os from "node:os"; import path from "node:path"; import { createApp } from "../src/server.js"; import { createPublisher } from "../src/publisher.js"; import { mockTelegram } from "../src/telegram.js"; import { CHANNELS, MATRIX, OFFICIAL, PUBLIC_SEND, publicGate, rightsConfirmed } from "../src/channels.js"; import { buildPack } from "../src/manual-pack.js"; import { TEXTS, LANGS } from "../src/i18n.js"; const tmp = () => path.join(fs.mkdtempSync(path.join(os.tmpdir(), "brm146-")), "plan.json"); async function withServer(fn) { const tg = mockTelegram(); const srv = createApp({ file: tmp(), telegram: tg }).listen(0); await new Promise((r) => srv.once("listening", r)); const base = `http://127.0.0.1:${srv.address().port}`; try { await fn(base, tg); } finally { srv.close(); } } const strip = (h) => h.replace(/<[^>]+>/g, " ").replace(/\s+/g, " "); test("Сценарий: Открыта матрица — 12 строк, у LinkedIn и Instagram заполнены все колонки (в ответе сервера)", () => withServer(async (base) => { const html = await (await fetch(base + "/channels.html")).text(); const box = html.split("