Skip to content

Commit a65260b

Browse files
committed
test: adds tier-ordering and border accent tests for tracked user items
1 parent 9ff0c4d commit a65260b

File tree

3 files changed

+43
-1
lines changed

3 files changed

+43
-1
lines changed

tests/components/dashboard/IssuesTab.test.tsx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,25 @@ describe("IssuesTab — left border accent in 'all' scope", () => {
456456
expect(listitem?.className).not.toContain("border-l-primary");
457457
});
458458

459+
it("adds border-l-primary to tracked user issue in monitored repo in 'all' scope", () => {
460+
const issues = [
461+
makeIssue({ id: 1, title: "Bot issue", repoFullName: "org/monitored", surfacedBy: ["tracked-bot[bot]"] }),
462+
];
463+
setTabFilter("issues", "scope", "all");
464+
setAllExpanded("issues", ["org/monitored"], true);
465+
466+
const { container } = render(() => (
467+
<IssuesTab
468+
issues={issues}
469+
userLogin="me"
470+
monitoredRepos={[{ owner: "org", name: "monitored", fullName: "org/monitored" }]}
471+
/>
472+
));
473+
474+
const listitem = container.querySelector('[role="listitem"]');
475+
expect(listitem?.className).toContain("border-l-primary");
476+
});
477+
459478
it("does not add border-l-2 in default 'involves_me' scope", () => {
460479
const issues = [
461480
makeIssue({ id: 1, title: "My issue", repoFullName: "org/repo", surfacedBy: ["me"] }),

tests/components/dashboard/PullRequestsTab.test.tsx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,25 @@ describe("PullRequestsTab — left border accent in 'all' scope", () => {
406406
expect(listitem?.className).not.toContain("border-l-primary");
407407
});
408408

409+
it("adds border-l-primary to tracked user PR in monitored repo in 'all' scope", () => {
410+
const prs = [
411+
makePullRequest({ id: 1, title: "Bot PR", repoFullName: "org/monitored", surfacedBy: ["tracked-bot[bot]"] }),
412+
];
413+
setTabFilter("pullRequests", "scope", "all");
414+
setAllExpanded("pullRequests", ["org/monitored"], true);
415+
416+
const { container } = render(() => (
417+
<PullRequestsTab
418+
pullRequests={prs}
419+
userLogin="me"
420+
monitoredRepos={[{ owner: "org", name: "monitored", fullName: "org/monitored" }]}
421+
/>
422+
));
423+
424+
const listitem = container.querySelector('[role="listitem"]');
425+
expect(listitem?.className).toContain("border-l-primary");
426+
});
427+
409428
it("does not add border-l-primary in default 'involves_me' scope", () => {
410429
const prs = [
411430
makePullRequest({ id: 1, title: "My PR", repoFullName: "org/repo", surfacedBy: ["me"] }),

tests/lib/grouping.test.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ describe("isUserInvolved", () => {
6363
const base = { repoFullName: "org/repo", userLogin: "author", assigneeLogins: [] as string[] };
6464
const monitored = new Set(["org/monitored"]);
6565

66-
it("returns true when surfacedBy includes user", () => {
66+
it("returns true when surfacedBy is non-empty (main user)", () => {
6767
expect(isUserInvolved({ ...base, surfacedBy: ["me"] }, "me", monitored)).toBe(true);
6868
});
6969

@@ -75,6 +75,10 @@ describe("isUserInvolved", () => {
7575
expect(isUserInvolved({ ...base, surfacedBy: ["bot1[bot]", "bot2"] }, "me", monitored)).toBe(true);
7676
});
7777

78+
it("returns true for monitored repo item with surfacedBy (tier 1 before tier 2)", () => {
79+
expect(isUserInvolved({ ...base, repoFullName: "org/monitored", surfacedBy: ["tracked-bot[bot]"] }, "me", monitored)).toBe(true);
80+
});
81+
7882
it("returns true for non-monitored item with no surfacedBy (fetched via involves:{user})", () => {
7983
expect(isUserInvolved(base, "me", monitored)).toBe(true);
8084
});

0 commit comments

Comments
 (0)