| author | |
| committer | |
| log | 5e5c52b7a70c16734e42faa072248a597e1333ee |
| tree | 5988bda363180b2a924fb6670f40d65e65f9837f |
| parent | 573cec01664d8bfef9da53dd31d68398e5814170 |
| signature | Signed by PGP key B5690EEEBB952194 |
Co-authored-by: Simone <185146821+Lucenx9@users.noreply.github.com>2 files changed, 23 insertions(+), 1 deletions(-)
packages/source-control-core/src/server/pullRequestChecks.test.ts+22| ... | ... | @@ -50,6 +50,28 @@ describe("dedupeChecks", () => { |
| 50 | 50 | ]); |
| 51 | 51 | }); |
| 52 | 52 | |
| 53 | it("keeps distinct workflow and check pairs even when their names join to the same text", () => { | |
| 54 | const checks = dedupeChecks([ | |
| 55 | entry("Linux tests", "success", { | |
| 56 | workflowName: "Build", | |
| 57 | at: "2026-08-11T16:00:00Z", | |
| 58 | }), | |
| 59 | entry("tests", "success", { | |
| 60 | workflowName: "Build Linux", | |
| 61 | at: "2026-08-11T17:00:00Z", | |
| 62 | }), | |
| 63 | entry("Linux tests", "failure", { | |
| 64 | workflowName: "Build", | |
| 65 | at: "2026-08-11T18:00:00Z", | |
| 66 | }), | |
| 67 | ]); | |
| 68 | ||
| 69 | expect(checks.map((check) => [check.name, check.status])).toEqual([ | |
| 70 | ["Linux tests", "failure"], | |
| 71 | ["tests", "success"], | |
| 72 | ]); | |
| 73 | }); | |
| 74 | ||
| 53 | 75 | it("loses a run that never said when it happened to one that did, whichever came first", () => { |
| 54 | 76 | const undated = dedupeChecks([ |
| 55 | 77 | entry("build", "success", { at: "2026-08-11T16:00:00Z" }), |
packages/source-control-core/src/server/pullRequestChecks.ts+1-1| ... | ... | @@ -36,7 +36,7 @@ export function dedupeChecks( |
| 36 | 36 | ): ReadonlyArray<PullRequestCheck> { |
| 37 | 37 | const newestByCheck = new Map<string, (typeof entries)[number]>(); |
| 38 | 38 | for (const entry of entries) { |
| 39 | const key = `${entry.workflowName ?? ""} ${entry.check.name}`; | |
| 39 | const key = JSON.stringify([entry.workflowName ?? "", entry.check.name]); | |
| 40 | 40 | const kept = newestByCheck.get(key); |
| 41 | 41 | // Re-setting a key a Map already holds keeps its first position, which is the order wanted. |
| 42 | 42 | if (kept === undefined || isAtLeastAsNew(entry.at, kept.at)) newestByCheck.set(key, entry); |