Skip to content
31 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.

What g1t can't do yet, and an open letter to Cloudflare1import assert from "node:assert/strict";
2import { test } from "node:test";
3
4import { ACCOUNT_SETTINGS, accountSettingsPage, settingsPathForHash } from "./account-settings.ts";
5
6test("every anchor of the old settings page lands on its own page", () => {
7 const cases: [string, string][] = [
8 ["#picture", "/settings/profile"],
9 ["#profile", "/settings/profile"],
10 ["#emails", "/settings/emails"],
11 ["#github", "/settings/github"],
12 ["#invites", "/settings/invites"],
13 ["#ssh-keys", "/settings/keys"],
14 ["#tokens", "/settings/tokens"],
15 ["#applications", "/settings/applications"],
16 ["#security-log", "/settings/security-log"],
17 ];
18 for (const [hash, path] of cases) assert.equal(settingsPathForHash(hash), path, hash);
19 assert.equal(settingsPathForHash(""), null);
20 assert.equal(settingsPathForHash("#nothing"), null);
21});
22
23test("a settings path names its page", () => {
24 for (const page of Object.keys(ACCOUNT_SETTINGS)) {
25 assert.equal(accountSettingsPage(`/settings/${page}`), page);
26 }
27 assert.equal(accountSettingsPage("/settings"), null);
28 assert.equal(accountSettingsPage("/settings/nope"), null);
One kind of access token; presence and status; usernames keep their case; the tour is a miniature of the real app; icons for password managers29 assert.equal(accountSettingsPage("/settings/tokens/tok_1"), "tokens", "a token's page is under Access tokens");
What g1t can't do yet, and an open letter to Cloudflare30 assert.equal(accountSettingsPage("/acme/web/settings/domains"), null);
31});

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