commit 4b2e5a6a7ecde2fa3cc896c7ed01c5b50e173a63
parent 863bcf24e7611530f546a5c438871e041647b7bc
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Wed, 14 Oct 2026 03:04:33 -0400
umtool: hrefs tests for the new addresses; test:scripts runs lib/work
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
2 files changed, 38 insertions(+), 18 deletions(-)
diff --git a/package.json b/package.json
@@ -24,7 +24,7 @@
"wt": "node scripts/worktree.mjs",
"e2e:sharded": "node scripts/run-sharded-e2e.mjs",
"e2e:all": "node scripts/e2e-all.mjs",
- "test:scripts": "node --test scripts/*.test.mjs umtool/report-to-video/*.test.mjs umtool/lib/*.test.mjs umtool/lib/report/*.test.mjs umtool/lib/annotations/*.test.mjs umtool/lib/articles/*.test.mjs umtool/lib/pieces/*.test.mjs umtool/lib/inbox/*.test.mjs",
+ "test:scripts": "node --test scripts/*.test.mjs umtool/report-to-video/*.test.mjs umtool/lib/*.test.mjs umtool/lib/report/*.test.mjs umtool/lib/annotations/*.test.mjs umtool/lib/articles/*.test.mjs umtool/lib/pieces/*.test.mjs umtool/lib/inbox/*.test.mjs umtool/lib/work/*.test.mjs",
"test": "pnpm -r --no-bail --no-sort --workspace-concurrency=1 run test; a=$?; pnpm run test:scripts; b=$?; [ $a -eq 0 ] && [ $b -eq 0 ]",
"typecheck": "pnpm -r --no-bail --no-sort --workspace-concurrency=1 exec tsc --noEmit",
"lint": "pnpm --filter export run lint",
diff --git a/umtool/lib/hrefs.test.mjs b/umtool/lib/hrefs.test.mjs
@@ -5,7 +5,7 @@ import * as H from "./hrefs.ts";
test("note is always the last parameter", () => {
assert.equal(H.articleHref({ site: "articles", id: "x" }, { note: "n1", tab: "source" }), "/articles/x?tab=source¬e=n1");
- assert.equal(H.projectHref("a/b", { note: "n2", all: true }), "/browse/a/b?all=1¬e=n2");
+ assert.equal(H.projectHref("a/b", { note: "n2", all: true }), "/projects/a/b?all=1¬e=n2");
assert.equal(H.withQuery("/p", { note: "sneaky", z: "1", a: "2" }, "n3"), "/p?z=1&a=2¬e=n3");
// A note passed in the query map never lands anywhere but the end -- and only via `note`.
assert.equal(H.withQuery("/p", { note: "sneaky", z: "1" }), "/p?z=1");
@@ -24,22 +24,24 @@ test("note is always the last parameter", () => {
test("withNote re-points an href and keeps note last, and the fragment after it", () => {
assert.equal(H.withNote("/articles/x?note=old&tab=source", "new"), "/articles/x?tab=source¬e=new");
- assert.equal(H.withNote("/browse/p", "n"), "/browse/p?note=n");
+ assert.equal(H.withNote("/projects/p", "n"), "/projects/p?note=n");
assert.equal(H.withNote("/sites/s?ws=a#files", "n"), "/sites/s?ws=a¬e=n#files");
});
test("project ids are encoded per segment, slashes kept", () => {
- assert.equal(H.projectHref("quartering-uh-song/videos/mortal-kombat"), "/browse/quartering-uh-song/videos/mortal-kombat");
- assert.equal(H.projectHref("a b/c?d"), "/browse/a%20b/c%3Fd");
- assert.equal(H.clipBenchHref("articles/x/i1", "c 04"), "/browse/articles/x/i1/clip/c%2004");
+ assert.equal(H.projectHref("quartering-uh-song/videos/mortal-kombat"), "/projects/quartering-uh-song/videos/mortal-kombat");
+ assert.equal(H.projectHref("a b/c?d"), "/projects/a%20b/c%3Fd");
+ assert.equal(H.clipBenchHref("articles/x/i1", "c 04"), "/projects/articles/x/i1/clip/c%2004");
assert.equal(H.encodePath("/lead//trail/"), "lead/trail");
});
test("empty, null and false values are left out; true is 1", () => {
- assert.equal(H.browseHref({}), "/browse");
- assert.equal(H.browseHref({ kind: "", state: undefined, q: "x y" }), "/browse?q=x+y");
- assert.equal(H.projectHref("p", { all: false }), "/browse/p");
- assert.equal(H.decisionsHref({ severity: "blocking", project: "a/b" }), "/browse/decisions?severity=blocking&project=a%2Fb");
+ assert.equal(H.workHref({}), "/work");
+ assert.equal(H.workHref({ kind: "", state: undefined, q: "x y" }), "/work?q=x+y");
+ assert.equal(H.projectHref("p", { all: false }), "/projects/p");
+ assert.equal(H.projectsHref({ kind: "song", new: false }), "/projects?kind=song");
+ assert.equal(H.projectsHref({ new: true }), "/projects?new=1");
+ assert.equal(H.homeHref({ hidden: true }), "/?hidden=1");
});
test("articles open in the store or on their site", () => {
@@ -50,17 +52,35 @@ test("articles open in the store or on their site", () => {
assert.equal(H.newArticleHref(), "/articles/new");
});
+test("the places: Inbox, Work (and the lists it replaced), Settings", () => {
+ assert.equal(H.decisionsHref({ severity: "blocking" }), "/");
+ assert.equal(H.browseHref({ kind: "song" }), "/work?kind=song");
+ assert.equal(H.articlesHref({ status: "draft" }), "/work?kind=article&status=draft");
+ assert.equal(H.systemHref(), "/settings/system");
+ assert.equal(H.researchHref(), "/research");
+});
+
+test("every page address the builders make is still served or redirected", async () => {
+ const { REDIRECTS } = await import("../redirects.mjs");
+ const old = ["/browse", "/browse/decisions", "/browse/find", "/browse/faces", "/browse/sources", "/browse/trim/:set", "/browse/at", "/browse/:path*", "/articles", "/sites", "/mix", "/bench"];
+ for (const s of old) assert.ok(REDIRECTS.some((r) => r.source === s), s);
+ for (const r of REDIRECTS) assert.equal(r.permanent, false, r.source);
+});
+
test("site pages, tools and piles", () => {
assert.equal(H.siteHref("jeralyzer"), "/sites/jeralyzer");
assert.equal(H.siteHref("jeralyzer", { ws: "w", rel: "a/b.md" }), "/sites/jeralyzer?ws=w&rel=a%2Fb.md#files");
- assert.equal(H.sitesHref({ status: "draft" }), "/sites?status=draft");
- assert.equal(H.findHref({ q: "um" }), "/browse/find?q=um");
- assert.equal(H.facesHref({ cover: "c 1" }), "/browse/faces?cover=c+1");
- assert.equal(H.sourcesHref(), "/browse/sources");
- assert.equal(H.trimHref("hooks"), "/browse/trim/hooks");
- assert.equal(H.mixHref({ body: "/a/b.wav", from: "p", start: 1.5 }), "/mix?body=%2Fa%2Fb.wav&from=p&start=1.5");
- assert.equal(H.pileHref("sort", { limit: 5 }), "/sort?limit=5");
- assert.equal(H.cutHref("yoshi", "wide", { plan: "p1" }), "/browse/yoshi/wide?plan=p1");
+ assert.equal(H.sitesHref({ status: "draft" }), "/work?by=site&status=draft");
+ assert.equal(H.findHref({ q: "um" }), "/tools/find?q=um");
+ assert.equal(H.facesHref({ cover: "c 1" }), "/tools/faces?cover=c+1");
+ assert.equal(H.sourcesHref(), "/tools/sources");
+ assert.equal(H.trimHref("hooks"), "/tools/trim/hooks");
+ assert.equal(H.mixHref({ body: "/a/b.wav", from: "p", start: 1.5 }), "/tools/mix?body=%2Fa%2Fb.wav&from=p&start=1.5");
+ assert.equal(H.pileHref("sort", { limit: 5 }), "/tools/song/sort?limit=5");
+ assert.equal(H.benchHref({ run: "r1" }), "/tools/bench?run=r1");
+ assert.equal(H.toolsHref(), "/tools");
+ assert.equal(H.songToolsHref(), "/tools/song");
+ assert.equal(H.cutHref("yoshi", "wide", { plan: "p1" }), "/projects/yoshi/wide?plan=p1");
assert.equal(H.homeHref({ from: "ch/vid" }), "/?from=ch%2Fvid");
assert.equal(H.homeHref(), "/");
});