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

test("settings fully covers the preserved chat screen in dark and light modes", async () => {
  const [app, contextCss, baseCss, chatsCss] = await Promise.all([
    readFile(new URL("../../App.jsx", import.meta.url), "utf8"),
    readFile(new URL("./context.css", import.meta.url), "utf8"),
    readFile(new URL("../../shared/styles/base.css", import.meta.url), "utf8"),
    readFile(new URL("../chats/chats.css", import.meta.url), "utf8")
  ]);

  assert.match(app, /<ChatsPanel active=\{!app\.newChatOpen && \(app\.tab === "threads" \|\| splitLayoutActive\)\}/);
  assert.match(app, /chatLayerVisible/);
  assert.match(chatsCss, /\.chat-search-bar,\.project-chat-composer\{[^}]*z-index:2/);
  assert.match(contextCss, /\.settings-page\{[^}]*position:relative[^}]*background:#111318/);
  assert.match(contextCss, /\.settings-page\{z-index:3\}/);
  assert.match(baseCss, /html\[data-theme="light"\] \.app-shell \.settings-page\{[^}]*background-color:#f7f7f8!important/);
});
