import test from "node:test";
import assert from "node:assert/strict";
import { readFile } from "node:fs/promises";

test("inactive screens pass React boolean values to inert", async () => {
  const [app, chats] = await Promise.all([
    readFile(new URL("../App.jsx", import.meta.url), "utf8"),
    readFile(new URL("../features/chats/ChatsPanel.jsx", import.meta.url), "utf8")
  ]);

  assert.match(app, /inert=\{app\.tab !== "chat"\}/);
  assert.match(chats, /inert=\{!active\}/);
  assert.doesNotMatch(`${app}\n${chats}`, /inert=\{[^}]*\? "" : undefined\}/);
});
