Pick any line to see why it is the way it is: the commit, the pull request and issue it came from, and what the agent was thinking.
| Merge Actions: cross-repo workflows and actions, release and deployment triggers, step timeouts | 1 | import assert from "node:assert/strict"; |
| 2 | import { test } from "node:test"; | |
| 3 | ||
| 4 | import { mayChangeComment } from "./comments.ts"; | |
| 5 | ||
| 6 | const ana = { id: "usr_1" }; | |
| 7 | ||
| 8 | test("its author edits and deletes their own comment", () => { | |
| 9 | const comment = { kind: "comment" as const, verdict: null, author: ana }; | |
| 10 | assert.deepEqual(mayChangeComment(comment, "usr_1", false), { edit: true, delete: true }); | |
| 11 | assert.deepEqual(mayChangeComment(comment, "usr_2", false), { edit: false, delete: false }); | |
| 12 | assert.deepEqual(mayChangeComment(comment, null, true), { edit: false, delete: false }); | |
| 13 | }); | |
| 14 | ||
| 15 | test("a maintainer edits and deletes anyone's", () => { | |
| 16 | const comment = { kind: "comment" as const, verdict: null, author: ana }; | |
| 17 | assert.deepEqual(mayChangeComment(comment, "usr_2", true), { edit: true, delete: true }); | |
| 18 | }); | |
| 19 | ||
| 20 | test("a review is edited but never deleted, and a note is never changed", () => { | |
| 21 | const review = { kind: "comment" as const, verdict: "approve" as const, author: ana }; | |
| 22 | assert.deepEqual(mayChangeComment(review, "usr_1", true), { edit: true, delete: false }); | |
| 23 | const note = { kind: "event" as const, verdict: null, author: ana }; | |
| 24 | assert.deepEqual(mayChangeComment(note, "usr_1", true), { edit: false, delete: false }); | |
| 25 | }); |
This file's history is long; its oldest lines are credited to the oldest commit read.