Git Repository link always shows, defaulting to the canonical upstream repo
Previously hidden entirely when NEXT_PUBLIC_GIT_REPO_URL was unset, which meant it never appeared on localhost or on anyone else's clone that hadn't explicitly configured it. It should always point somewhere - the canonical repo (git.ciagent.org) is the sensible default everywhere, overridable only by a deployment that runs its own separate git server. Co-Authored-By: Claude Sonnet 5 <[email protected]>
This commit is contained in:
@@ -68,17 +68,21 @@ describe("LandingPage", () => {
|
||||
expect(screen.queryByText(/local mode/i)).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("hides the Git Repository link when no NEXT_PUBLIC_GIT_REPO_URL is configured", () => {
|
||||
renderWithQueryClient(<LandingPage />);
|
||||
expect(screen.queryByRole("link", { name: /git repository/i })).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("shows a Git Repository link opening in a new tab when configured", () => {
|
||||
vi.stubEnv("NEXT_PUBLIC_GIT_REPO_URL", "https://git.ciagent.org/admin/ci-agent");
|
||||
it("falls back to the canonical upstream repo when NEXT_PUBLIC_GIT_REPO_URL is unset", () => {
|
||||
renderWithQueryClient(<LandingPage />);
|
||||
|
||||
const link = screen.getByRole("link", { name: /git repository/i });
|
||||
expect(link).toHaveAttribute("href", "https://git.ciagent.org/admin/ci-agent");
|
||||
expect(link).toHaveAttribute("href", "https://git.ciagent.org/saksham/CIAgent");
|
||||
expect(link).toHaveAttribute("target", "_blank");
|
||||
expect(link).toHaveAttribute("rel", "noopener noreferrer");
|
||||
});
|
||||
|
||||
it("points the Git Repository link at a custom fork when configured", () => {
|
||||
vi.stubEnv("NEXT_PUBLIC_GIT_REPO_URL", "https://git.example.com/someone/ci-agent");
|
||||
renderWithQueryClient(<LandingPage />);
|
||||
|
||||
const link = screen.getByRole("link", { name: /git repository/i });
|
||||
expect(link).toHaveAttribute("href", "https://git.example.com/someone/ci-agent");
|
||||
expect(link).toHaveAttribute("target", "_blank");
|
||||
expect(link).toHaveAttribute("rel", "noopener noreferrer");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user