// Task 250 — `claude-ptys.slice` unit emitted at install time. Every
// `claude-session-*.scope` the session manager spawns drops under this
// slice, so the operator can see the cohort with one `systemctl --user
// status claude-ptys.slice`. This test pins the unit file shape so a
// future refactor cannot silently drop [Install] (which would leave the
// slice un-enabled after install).
import test from "node:test";
import assert from "node:assert/strict";
import { buildClaudePtysSliceUnitFile } from "../port-resolution.js";
test("buildClaudePtysSliceUnitFile emits a valid systemd slice unit", () => {
    const unit = buildClaudePtysSliceUnitFile();
    assert.match(unit, /^\[Unit\]$/m);
    assert.match(unit, /^Description=Claude Code PTY sessions \(Task 250\)$/m);
    assert.match(unit, /^\[Slice\]$/m);
    assert.match(unit, /^\[Install\]$/m);
    assert.match(unit, /^WantedBy=default\.target$/m);
});
test("buildClaudePtysSliceUnitFile output has no per-brand or per-install template tokens", () => {
    // The slice is brand-agnostic. If a refactor accidentally introduces a
    // template token (e.g. ${INSTALL_DIR}), the slice file would be invalid
    // after install. Catch the regression at the source.
    const unit = buildClaudePtysSliceUnitFile();
    assert.doesNotMatch(unit, /\$\{/);
    assert.doesNotMatch(unit, /__[A-Z_]+__/);
});
