g1t/apps/web/app/lib/account-settings.test.ts

30 lines1,220 bytesCodeBlame

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.

status.g1t.sh with incident management, invites that land you in the workspace, settings as pages, usage without quotas1import 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);
29 assert.equal(accountSettingsPage("/acme/web/settings/domains"), null);
30});