|
1 | 1 | import { describe, expect, test } from "bun:test" |
2 | 2 | import { loadPrAnalysis } from "../lib/data-processing/storePrAnalysis" |
3 | 3 |
|
4 | | -// test.failing exists in the Bun runtime but isn't in this repo's bun-types yet. |
5 | | -declare module "bun:test" { |
6 | | - interface Test { |
7 | | - failing(label: string, fn: () => void | Promise<unknown>): void |
8 | | - } |
9 | | -} |
10 | | - |
11 | | -// Repro for the renamed-contributor bug: when a contributor renames their GitHub |
12 | | -// account, cached PR analyses keep the OLD login while newer PRs use the new one, |
13 | | -// so the tracker counts one person as two (two overview cards, two "PRs by |
14 | | -// contributor" groups, split sponsorship totals). |
| 4 | +// Regression test for the renamed-contributor bug: when a contributor renames |
| 5 | +// their GitHub account, cached PR analyses keep the OLD login while newer PRs use |
| 6 | +// the new one. Without canonicalization the tracker counts one person as two |
| 7 | +// (two overview cards, two "PRs by contributor" groups, split sponsorship totals). |
15 | 8 | // |
16 | | -// pr-analysis/2026-07-07.json really contains PRs cached under BOTH |
17 | | -// technologyet31-create (pre-rename) and abdalraof-albarbar (post-rename) for the |
18 | | -// same person. This assertion fails on main; it is marked test.failing so CI |
19 | | -// stays green until the fix canonicalizes the login on load. |
| 9 | +// pr-analysis/2026-07-07.json contains PRs cached under both technologyet31-create |
| 10 | +// (pre-rename) and abdalraof-albarbar (post-rename); loadPrAnalysis must return |
| 11 | +// them under the single current login. |
20 | 12 |
|
21 | | -describe("renamed contributor is counted once (repro)", () => { |
22 | | - test.failing( |
23 | | - "cached PRs from before a rename load under the current login", |
24 | | - () => { |
25 | | - const prs = loadPrAnalysis("2026-07-07") |
26 | | - const renamed = prs.filter( |
27 | | - (pr) => |
28 | | - pr.contributor === "abdalraof-albarbar" || |
29 | | - pr.contributor === "technologyet31-create", |
30 | | - ) |
31 | | - // Sanity: this week really contains the renamed contributor's PRs. |
32 | | - expect(renamed.length).toBeGreaterThan(0) |
33 | | - // The bug: those PRs load under two logins instead of one. |
34 | | - const logins = [...new Set(renamed.map((pr) => pr.contributor))] |
35 | | - expect(logins).toEqual(["abdalraof-albarbar"]) |
36 | | - }, |
37 | | - ) |
| 13 | +describe("renamed contributor is counted once", () => { |
| 14 | + test("cached PRs from before a rename load under the current login", () => { |
| 15 | + const prs = loadPrAnalysis("2026-07-07") |
| 16 | + const renamed = prs.filter( |
| 17 | + (pr) => |
| 18 | + pr.contributor === "abdalraof-albarbar" || |
| 19 | + pr.contributor === "technologyet31-create", |
| 20 | + ) |
| 21 | + // Sanity: this week really contains the renamed contributor's PRs. |
| 22 | + expect(renamed.length).toBeGreaterThan(0) |
| 23 | + // They must load under one login, not two. |
| 24 | + const logins = [...new Set(renamed.map((pr) => pr.contributor))] |
| 25 | + expect(logins).toEqual(["abdalraof-albarbar"]) |
| 26 | + }) |
38 | 27 | }) |
0 commit comments