import { expect } from "e2e";
import { test, WEB } from "./t3.ts";

test("File mentions include Markdown re-included by root .ignore", WEB, async ({ t3, app, screen }) => {
  const project = await t3.project("ignore-reinclude", {
    ".gitignore": "notes/\n",
    ".ignore": "!notes/\nnotes/**/*\n!notes/**/\n!notes/**/*.md\n",
    "notes/daily/standup.md": "# Daily standup\n",
    "notes/daily/standup.txt": "Excluded plain text\n",
    "src/standup-helper.ts": "export {};\n",
  });
  const thread = await t3.thread({ project, title: "File search proof", messages: ["Ready"] });
  await t3.open(thread);
  await screen.getByRole("textbox").pressSequentially("@standup");
  await screen.getByRole("option", "standup-helper.ts", { exact: false }).waitFor({ state: "visible" });
  await app.screenshot("standup-file-suggestions");
  await expect(screen.getByRole("option", "standup.md", { exact: false })).toBeVisible();
});
