g1t/apps/web/app/lib/trial.test.ts
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.
| Team plan, an open-source pool, monthly trials and honest metering; the sidebar for everyone; a workspace that stays put | 1 | import assert from "node:assert/strict"; |
| 2 | import { test } from "node:test"; | |
| 3 | ||
| 4 | import { trialClosed } from "./trial.ts"; | |
| 5 | ||
| 6 | const base = { usedMicros: 0, limitMicros: 1_000_000, endsAt: null }; | |
| 7 | ||
| 8 | test("an open trial says nothing", () => { | |
| 9 | assert.equal(trialClosed({ ...base, open: true, reason: null }, "acme"), null); | |
| 10 | assert.equal(trialClosed(null, "acme"), null); | |
| 11 | }); | |
| 12 | ||
| 13 | test("a spent trial and a given-out month say so", () => { | |
| 14 | assert.equal(trialClosed({ ...base, open: false, reason: "used" }, "acme"), "acme has used its trial credit on g1t."); | |
| 15 | assert.equal( | |
| 16 | trialClosed({ ...base, open: false, reason: "pool", waitsUntil: "2026-11-01T00:00:00Z" }, "acme"), | |
| 17 | "This month's free trials are all given out; new ones start on November 1.", | |
| 18 | ); | |
| 19 | }); |