// Task 142 — manager systemd unit must stamp PLATFORM_PORT equal to
// MAXY_UI_INTERNAL_PORT so admin and whatsapp MCP servers inherit the
// internal-loopback port. The producer-side gap closed in Task 142
// after Task 139 removed every consumer-side fallback.
import test from "node:test";
import assert from "node:assert/strict";
import { buildClaudeSessionManagerUnitFile } from "../port-resolution.js";
test("PLATFORM_PORT stamped on manager unit equal to MAXY_UI_INTERNAL_PORT", () => {
    const unit = buildClaudeSessionManagerUnitFile({
        productName: "Maxy",
        brandHostname: "maxy",
        installDir: "/opt/maxy",
        persistDir: "/home/admin/.maxy",
        claudeSessionManagerPort: 11200,
        brandPort: 19200,
        maxyUiInternalPort: 19201,
        accountId: "00000000-0000-0000-0000-000000000000",
        cdpPort: 9222,
    });
    assert.match(unit, /^Environment=PLATFORM_PORT=19201$/m);
    assert.match(unit, /^Environment=MAXY_UI_INTERNAL_PORT=19201$/m);
    assert.match(unit, /^Environment=MAXY_BRAND_PORT=19200$/m);
    // Task 492 — CDP_PORT stamped so the browser plugin's MCP server can
    // attach to the per-brand VNC Chromium.
    assert.match(unit, /^Environment=CDP_PORT=9222$/m);
    // Order is not asserted; coexistence with the existing brand-port and
    // internal-port lines is what producers and consumers contract on.
});
