Add GitLab tracking persistence, analytics, and reconciliation coverage across core, dashboard, and CLI paths. - Store GitLab tracking and closed-at metadata when importing issues and merge requests from CLI, extension tools, and dashboard routes. - Add GitLab source-issue analytics, Command Center GitLab signal surfaces, CSV export fields, and a closed-at backfill route. - Cover GitLab tracking storage, reconciliation, CLI imports, dashboard import UI, route behavior, and Command Center signals with focused tests. Files changed: .changeset/fn-7428-gitlab-import-tracking.md | 7 + .../__tests__/extension-gitlab-tracking.test.ts | 140 ++++++++++++ .../__tests__/task-command-gitlab-import.test.ts | 18 +- packages/cli/src/commands/task.ts | 1 + packages/cli/src/extension.ts | 2 +- .../src/__tests__/gitlab-issue-analytics.test.ts | 243 +++++++++++++++++++++ .../__tests__/gitlab-source-issue-storage.test.ts | 128 +++++++++++ .../store-gitlab-tracking-reconcile.test.ts | 125 +++++++++++ packages/core/src/gitlab-issue-analytics.ts | 227 +++++++++++++++++++ packages/core/src/index.ts | 8 + packages/core/src/store.ts | 21 +- .../__tests__/GitHubImportModal.test.tsx | 46 ++++ .../components/__tests__/gitlabTracking.test.tsx | 43 ++++ .../components/command-center/CommandCenter.tsx | 5 + .../components/command-center/areas/GitlabArea.tsx | 126 +++++++++++ .../areas/__tests__/areas.gitlab-signals.test.tsx | 83 +++++++ .../gitlab-source-issue-reconciler.test.ts | 187 ++++++++++++++++ .../register-command-center-routes.test.ts | 52 +++++ .../__tests__/register-git-gitlab.backfill.test.ts | 116 ++++++++++ .../dashboard/src/__tests__/routes-gitlab.test.ts | 59 +++-- packages/dashboard/src/command-center-csv.ts | 21 ++ .../src/gitlab-source-issue-reconciler.ts | 104 +++++++++ packages/dashboard/src/gitlab.ts | 16 +- .../src/routes/register-command-center-routes.ts | 25 +++ packages/dashboard/src/routes/register-gitlab.ts | 29 +++ 25 files changed, 1800 insertions(+), 32 deletions(-) Fusion-Task-Id: FN-7428 Fusion-Task-Lineage: 7b0ebb5c-c6e7-42a9-a339-b2dd1d4e263a Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai>
44 lines
2.0 KiB
TypeScript
44 lines
2.0 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { render, screen } from "@testing-library/react";
|
|
import { GitLabBadge, formatGitLabBadgeKind, formatGitLabBadgeMarker } from "../GitLabBadge";
|
|
import type { TaskGitLabTrackedItem } from "@fusion/core";
|
|
|
|
const baseItem: TaskGitLabTrackedItem = {
|
|
kind: "project_issue",
|
|
url: "https://gitlab.example.test/group/project/-/issues/42",
|
|
instanceUrl: "https://gitlab.example.test",
|
|
host: "gitlab.example.test",
|
|
iid: 42,
|
|
projectPath: "group/project",
|
|
title: "Fix GitLab bug",
|
|
state: "opened",
|
|
};
|
|
|
|
describe("GitLab tracking UI helpers", () => {
|
|
it("formats provider-specific issue, group issue, and merge request badges", () => {
|
|
expect(formatGitLabBadgeKind(baseItem)).toBe("Issue");
|
|
expect(formatGitLabBadgeMarker(baseItem)).toBe("#42");
|
|
expect(formatGitLabBadgeKind({ kind: "group_issue" })).toBe("Group issue");
|
|
expect(formatGitLabBadgeMarker({ kind: "group_issue", iid: 7 })).toBe("#7");
|
|
expect(formatGitLabBadgeKind({ kind: "merge_request" })).toBe("MR");
|
|
expect(formatGitLabBadgeMarker({ kind: "merge_request", iid: 5 })).toBe("!5");
|
|
});
|
|
|
|
it("renders linked and stale GitLab badges without GitHub copy", () => {
|
|
const { rerender } = render(<GitLabBadge item={baseItem} />);
|
|
const badge = screen.getByTestId("card-gitlab-badge");
|
|
expect(badge).toHaveAttribute("href", baseItem.url);
|
|
expect(badge).toHaveAttribute("aria-label", "GitLab Issue #42: Fix GitLab bug");
|
|
expect(badge).toHaveTextContent("#42");
|
|
expect(badge).not.toHaveTextContent("GitHub");
|
|
|
|
rerender(<GitLabBadge item={{ ...baseItem, staleAt: "2026-07-02T00:00:00.000Z", staleReason: "GitLab sync failed" }} />);
|
|
expect(screen.getByTestId("card-gitlab-badge")).toHaveAttribute("aria-label", "GitLab Issue #42: Fix GitLab bug — stale: GitLab sync failed");
|
|
});
|
|
|
|
it("renders no empty shell when no GitLab metadata exists", () => {
|
|
const { container } = render(<GitLabBadge item={undefined} />);
|
|
expect(container).toBeEmptyDOMElement();
|
|
});
|
|
});
|