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

test("Forge-named insteadOf shorthand shares the canonical GitHub tracker", WEB, async ({t3, app, screen}) => {
  const config = (prefix: string) => `[core]\n\tbare = false\n[remote "origin"]\n\turl = ${prefix}:pingdotgg/t3code.git\n\tfetch = +refs/heads/*:refs/remotes/origin/*\n[url "https://github.com/"]\n\tinsteadOf = ${prefix}:\n`;
  await t3.project("repro-github", {".git/config": config("github")});
  await t3.project("repro-gh", {".git/config": config("gh")});
  await t3.open("/issues");
  // Both tracker summaries are loaded before capturing the static grouping.
  await screen.getByRole("heading", /GitHub.*github.com/).waitFor({state:"visible"});
  await app.screenshot("github-tracker-grouping");
  await expect(screen.getByRole("heading", /GitHub.*github.com.*2 projects/)).toBeVisible();
  await expect(screen.getByRole("heading", /GitHub/)).toHaveCount(1);
});
