Skip to content

Where people and agents ship software together. The open-source git platform for the whole job: issues, agents, checks and deploys to the edge.

g1t.sh
40 linesCodeBlameRaw

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.

Git storage hardened, pages in tens of milliseconds, honest security alerts, and costs reconciled daily1import assert from "node:assert/strict";
2import { test } from "node:test";
3
4import type { AccountEmail } from "@g1t/contracts";
5
6import { addressActions, backupChoices, pendingFields } from "./emails.ts";
7
8const email = (address: string, verified: boolean, primary = false): AccountEmail => ({
9 email: address,
10 verified,
11 primary,
12 backup: false,
13 createdAt: "2026-10-05T00:00:00.000Z",
14 verifiedAt: verified ? "2026-10-05T00:00:00.000Z" : null,
15});
16
17test("the primary cannot be removed, and only a confirmed address can become it", () => {
18 const all = [email("a@x.io", true, true), email("b@x.io", true), email("c@x.io", false)];
19 assert.deepEqual(addressActions(all[0]!, all), { makePrimary: false, remove: false, resend: false });
20 assert.deepEqual(addressActions(all[1]!, all), { makePrimary: true, remove: true, resend: false });
21 assert.deepEqual(addressActions(all[2]!, all), { makePrimary: false, remove: true, resend: true });
22});
23
24test("the last confirmed address stays, even when it is not the primary", () => {
25 const all = [email("a@x.io", false, true), email("b@x.io", true)];
26 assert.equal(addressActions(all[1]!, all).remove, false);
27});
28
29test("the backup is a confirmed address other than the primary", () => {
30 const all = [email("a@x.io", true, true), email("b@x.io", true), email("c@x.io", false)];
31 assert.deepEqual(backupChoices(all).map((choice) => choice.email), ["b@x.io"]);
32});
33
34test("a change waiting on the password keeps its fields but never the password", () => {
35 const form = new FormData();
36 form.set("intent", "remove-email");
37 form.set("email", "b@x.io");
38 form.set("password", "hunter22hunter22");
39 assert.deepEqual(pendingFields(form), { email: "b@x.io" });
40});

This file's history is long; its oldest lines are credited to the oldest commit read.