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.
| g1t is one name: its agent's work, commits and comments show as @g1t, and nobody can claim g1t or g1t-agent | 1 | import assert from "node:assert/strict"; |
| 2 | import { test } from "node:test"; | |
| 3 | ||
| g1t is the stored author of what it opens; the person who asked is requested_by and keeps the author's rights | 4 | import { workOwner } from "../../../../packages/contracts/src/work.ts"; |
| g1t is one name: its agent's work, commits and comments show as @g1t, and nobody can claim g1t or g1t-agent | 5 | import { madeByG1t, openedBy } from "./opened-by.ts"; |
| 6 | ||
| g1t is the stored author of what it opens; the person who asked is requested_by and keeps the author's rights | 7 | const syntaqx = { id: "usr_1", username: "syntaqx" }; |
| 8 | const g1t = { id: "usr_g1t_agent", username: "g1t", kind: "agent" as const }; | |
| g1t is one name: its agent's work, commits and comments show as @g1t, and nobody can claim g1t or g1t-agent | 9 | |
| g1t is the stored author of what it opens; the person who asked is requested_by and keeps the author's rights | 10 | test("a pull request g1t made shows g1t, requested by whoever asked", () => { |
| 11 | const pull = { agent: "g1t", branch: null, author: g1t, requestedBy: syntaqx }; | |
| g1t is one name: its agent's work, commits and comments show as @g1t, and nobody can claim g1t or g1t-agent | 12 | assert.equal(madeByG1t(pull), true); |
| 13 | assert.deepEqual(openedBy(pull), { name: "g1t", requestedBy: "syntaqx" }); | |
| g1t is the stored author of what it opens; the person who asked is requested_by and keeps the author's rights | 14 | // It is theirs to manage, as their own would be. |
| 15 | assert.equal(workOwner(pull).id, "usr_1"); | |
| g1t is one name: its agent's work, commits and comments show as @g1t, and nobody can claim g1t or g1t-agent | 16 | }); |
| 17 | ||
| 18 | test("anything else shows its author", () => { | |
| 19 | // Someone's own agent. | |
| g1t is the stored author of what it opens; the person who asked is requested_by and keeps the author's rights | 20 | assert.deepEqual(openedBy({ author: syntaqx, requestedBy: null }), { name: "syntaqx", requestedBy: null }); |
| g1t is one name: its agent's work, commits and comments show as @g1t, and nobody can claim g1t or g1t-agent | 21 | // A branch pushed to the repository, even with g1t named on it. |
| 22 | assert.equal(madeByG1t({ agent: "g1t", branch: "fix-login" }), false); | |
| g1t is the stored author of what it opens; the person who asked is requested_by and keeps the author's rights | 23 | assert.equal(workOwner({ author: syntaqx, requestedBy: null }).id, "usr_1"); |
| g1t is one name: its agent's work, commits and comments show as @g1t, and nobody can claim g1t or g1t-agent | 24 | }); |
| 25 | ||
| 26 | test("work g1t started itself names nobody as asking", () => { | |
| g1t is the stored author of what it opens; the person who asked is requested_by and keeps the author's rights | 27 | const pull = { author: { id: "g1t", username: "g1t", kind: "system" as const }, requestedBy: null }; |
| g1t is one name: its agent's work, commits and comments show as @g1t, and nobody can claim g1t or g1t-agent | 28 | assert.deepEqual(openedBy(pull), { name: "g1t", requestedBy: null }); |
| g1t is the stored author of what it opens; the person who asked is requested_by and keeps the author's rights | 29 | assert.equal(workOwner(pull).username, "g1t"); |
| g1t is one name: its agent's work, commits and comments show as @g1t, and nobody can claim g1t or g1t-agent | 30 | }); |