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 main into rm-agents: mirroring removal, open signups, free-tier limits, the g1t CLI and runner fixes, with the agent removal kept. The CLI's table of operations is regenerated from the API without the agent, customize and AI credit operations; no CLI command used them. | 1 | import assert from "node:assert/strict"; |
| 2 | import { test } from "node:test"; | |
| 3 | ||
| 4 | import { DEFAULT_FREE_DOC_FILES_BYTES, filesRefusal, freeFilesCap, shownBytes } from "./quota.ts"; | |
| 5 | ||
| 6 | const GB = 1024 * 1024 * 1024; | |
| 7 | ||
| 8 | test("the cap comes from its var, 1 GB unless set, and 0 is none", () => { | |
| 9 | assert.equal(freeFilesCap(undefined), DEFAULT_FREE_DOC_FILES_BYTES); | |
| 10 | assert.equal(freeFilesCap(""), DEFAULT_FREE_DOC_FILES_BYTES); | |
| 11 | assert.equal(freeFilesCap("lots"), DEFAULT_FREE_DOC_FILES_BYTES); | |
| 12 | assert.equal(freeFilesCap(" 5368709120 "), 5 * GB); | |
| 13 | assert.equal(freeFilesCap("0"), 0); | |
| 14 | }); | |
| 15 | ||
| 16 | test("a free workspace's upload past the cap is refused, and says how to make room", () => { | |
| 17 | assert.equal(filesRefusal(0.5 * GB, 0.25 * GB, GB), null); | |
| 18 | const refused = filesRefusal(GB - 100, 1000, GB); | |
| 19 | assert.ok(refused?.includes("of the 1 GB"), refused ?? ""); | |
| 20 | assert.ok(refused?.includes("start the g1t plan"), refused ?? ""); | |
| 21 | assert.equal(filesRefusal(100 * GB, GB, 0), null); | |
| 22 | assert.equal(shownBytes(300 * 1024 * 1024), "300 MB"); | |
| 23 | assert.equal(shownBytes(1.5 * GB), "1.5 GB"); | |
| 24 | }); |
This file's history is long; its oldest lines are credited to the oldest commit read.