Public: anyone can read this; the crew can change it.
/explore sorts by newest or most forked with two plain links kept in the URL, the active one marked #13556
Check · Review · Land · Live done — Landed and live in production.
scout/forge:scout/13523-explore-sorts-by-newest-or-most-forked-w → main 6 commits fork 2 threads · 2 unresolved
7 files
changed +90
−16
docs/features/explore.md +4 −3
| @@ -12,13 +12,14 @@ | ||
| 12 | 12 | | `likes` | likes on posts about the app | |
| 13 | 13 | | `use` | hours awake in the last 30 days | |
| 14 | 14 | | `fresh` | the last merge | |
| 15 | | `new` | the most recently made app first (a person by their newest app) | | |
| 15 | 16 | | `name` | A to Z | |
| 16 | 17 | |
| 17 | The page's tabs are Best, Forks, Shipped, Liked, Use and Fresh; a row shows `N likes` when N > 0, on the web and in the terminal. | |
| 18 | The page's tabs are Best, Forks, Shipped, Liked, Use, Fresh and Newest; a row shows `N likes` when N > 0, on the web and in the terminal. | |
| 18 | 19 | |
| 19 | 20 | ## Why a row ranks where it does (#11296) |
| 20 | 21 | |
| 21 | Each row's meta line starts with one phrase for the signal that most explains its place: `12 forks`, `3 shipped this month`, `2 likes`, `shipped today`, `in use`. On a named sort it is that sort's signal; on `score` it is the largest term of the score, weighed as the ranking weighs them (`frontScore` at the forge's front weights, and `LIKE_WEIGHT` for likes; a tie goes to forks, ships, likes, freshness, use). `whyOf` in `actions/explore.ts` reads it from the row's numbers, with no query. The number the phrase says is left out of the rest of the line, so nothing is said twice. The terminal's explorer lines (`/` then `kind:` or `sort:`) show the same phrase first and drop the same duplicate. A row with nothing to say has no phrase; `sort:name` has none. | |
| 22 | Each row's meta line starts with one phrase for the signal that most explains its place: `12 forks`, `3 shipped this month`, `2 likes`, `shipped today`, `in use`. On a named sort it is that sort's signal; on `score` it is the largest term of the score, weighed as the ranking weighs them (`frontScore` at the forge's front weights, and `LIKE_WEIGHT` for likes; a tie goes to forks, ships, likes, freshness, use). `whyOf` in `actions/explore.ts` reads it from the row's numbers, with no query. The number the phrase says is left out of the rest of the line, so nothing is said twice. The terminal's explorer lines (`/` then `kind:` or `sort:`) show the same phrase first and drop the same duplicate. A row with nothing to say has no phrase; `sort:name` and `sort:new` have none. | |
| 22 | 23 | |
| 23 | 24 | ## How likes count |
| 24 | 25 | |
| @@ -36,7 +37,7 @@ What a person filters on `/explore` an agent filters with the same words. Each f | ||
| 36 | 37 | |
| 37 | 38 | | the page offers | the parameter | API `GET /api/v1/explore` | MCP `explore` | |
| 38 | 39 | |---|---|---|---| |
| 39 | | Best / Forks / Shipped / Liked / Use / Fresh | `sort=score` `forks` `ships` `likes` `use` `fresh` (`name` by hand) | `?sort=forks` | `{ sort: "forks" }` | | |
| 40 | | Best / Forks / Shipped / Liked / Use / Fresh / Newest | `sort=score` `forks` `ships` `likes` `use` `fresh` `new` (`name` by hand) | `?sort=forks` | `{ sort: "forks" }` | | |
| 40 | 41 | | All / Apps / People / Forges (admin) | `kind=app` `person` `forge` | `?kind=app` | `{ kind: "app" }` | |
| 41 | 42 | | Any time / Today / This week / This month | `since=1d` `7d` `30d` (`updated=` is the same) | `?since=7d` | `{ since: "7d" }` | |
| 42 | 43 | | Show archived | `archived=yes` | `?archived=yes` | `{ archived: "yes" }` | |
src/actions/explore.ts +12 −2
| @@ -30,7 +30,7 @@ import { | ||
| 30 | 30 | type FrontWeights, |
| 31 | 31 | } from "../core/front.ts"; |
| 32 | 32 | import { isSafeName } from "../git/guard.ts"; |
| 33 | import { canEnterApp, listReposVisibleTo, type Repo } from "../core/repos.ts"; | |
| 33 | import { canEnterApp, listReposVisibleTo, repoDatesFor, type Repo } from "../core/repos.ts"; | |
| 34 | 34 | import { getUsersByIds, isActive, type User } from "../core/users.ts"; |
| 35 | 35 | import { rankInputs } from "../core/rank_inputs.ts"; |
| 36 | 36 | import { writeStamp } from "../core/write_clock.ts"; |
| @@ -46,6 +46,7 @@ export type ExploreSort = | ||
| 46 | 46 | | "likes" |
| 47 | 47 | | "use" |
| 48 | 48 | | "fresh" |
| 49 | | "new" | |
| 49 | 50 | | "name"; |
| 50 | 51 | |
| 51 | 52 | export interface ExploreQuery { |
| @@ -100,6 +101,7 @@ const SORTS: readonly ExploreSort[] = [ | ||
| 100 | 101 | "likes", |
| 101 | 102 | "use", |
| 102 | 103 | "fresh", |
| 104 | "new", | |
| 103 | 105 | "name", |
| 104 | 106 | ]; |
| 105 | 107 | |
| @@ -379,7 +381,7 @@ export function whyOf( | ||
| 379 | 381 | fresh: shippedWords(row.shippedAt, now), |
| 380 | 382 | use: n.awakeHours > 0 ? "in use" : "", |
| 381 | 383 | }; |
| 382 | if (sort === "name") return undefined; | |
| 384 | if (sort === "name" || sort === "new") return undefined; | |
| 383 | 385 | if (sort !== "score") { |
| 384 | 386 | const signal: WhySignal = sort; |
| 385 | 387 | return text[signal] === "" ? undefined : { signal, text: text[signal] }; |
| @@ -419,6 +421,8 @@ export interface ExploreRow { | ||
| 419 | 421 | readonly apps: number; |
| 420 | 422 | }; |
| 421 | 423 | readonly shippedAt: string | null; |
| 424 | /** When the app was made (a person: their newest app); read only for `sort:new`. */ | |
| 425 | readonly createdAt?: string; | |
| 422 | 426 | readonly score: number; |
| 423 | 427 | /** An app's repository, for "Make it yours". */ |
| 424 | 428 | readonly repo?: { readonly owner: string; readonly name: string; readonly id: string; readonly branch: string; readonly public: boolean }; |
| @@ -656,6 +660,8 @@ function rank( | ||
| 656 | 660 | ); |
| 657 | 661 | }, |
| 658 | 662 | ); |
| 663 | // Creation dates cost a read, so only the newest sort makes it (one chunked query). | |
| 664 | const dates = query.sort === "new" ? repoDatesFor(db, appRepos.map((r) => r.id)) : undefined; | |
| 659 | 665 | const weights = frontWeights(db); |
| 660 | 666 | const signals = frontSignals( |
| 661 | 667 | db, |
| @@ -706,6 +712,7 @@ function rank( | ||
| 706 | 712 | apps: 1, |
| 707 | 713 | }, |
| 708 | 714 | shippedAt: s.shippedAt, |
| 715 | ...(dates?.get(repo.id) === undefined ? {} : { createdAt: dates.get(repo.id)!.createdAt }), | |
| 709 | 716 | score: frontScore(s, now, weights) + LIKE_WEIGHT * Math.log1p(liked), |
| 710 | 717 | repo: { |
| 711 | 718 | owner: repo.ownerName, |
| @@ -727,6 +734,7 @@ function rank( | ||
| 727 | 734 | .filter((t): t is string => t !== null) |
| 728 | 735 | .sort() |
| 729 | 736 | .at(-1); |
| 737 | const newest = [was?.createdAt, row.createdAt].filter((t): t is string => t !== undefined).sort().at(-1); | |
| 730 | 738 | const owner = owners.get(repo.ownerId); |
| 731 | 739 | const mark = markOf(owner); |
| 732 | 740 | people.set(repo.ownerName, { |
| @@ -744,6 +752,7 @@ function rank( | ||
| 744 | 752 | apps: (was?.numbers.apps ?? 0) + 1, |
| 745 | 753 | }, |
| 746 | 754 | shippedAt: latest ?? null, |
| 755 | ...(newest === undefined ? {} : { createdAt: newest }), | |
| 747 | 756 | // A person ranks by their best app, so one with many small ones |
| 748 | 757 | // does not crowd out everything else. |
| 749 | 758 | score: Math.max(was?.score ?? 0, row.score), |
| @@ -800,6 +809,7 @@ function sortKey(r: ExploreRow, sort: ExploreSort): number | string { | ||
| 800 | 809 | case "likes": return r.numbers.likes; |
| 801 | 810 | case "use": return r.numbers.awakeHours; |
| 802 | 811 | case "fresh": return r.shippedAt === null ? 0 : Date.parse(r.shippedAt) || 0; |
| 812 | case "new": return r.createdAt === undefined ? 0 : Date.parse(r.createdAt) || 0; | |
| 803 | 813 | case "name": return r.name.toLowerCase(); |
| 804 | 814 | } |
| 805 | 815 | } |
src/web/studio/explore.ts +1
| @@ -206,6 +206,7 @@ export async function explorePage(ctx: Ctx): Promise<Response> { | ||
| 206 | 206 | { label: "Liked", sort: "likes" as const }, |
| 207 | 207 | { label: "Use", sort: "use" as const }, |
| 208 | 208 | { label: "Fresh", sort: "fresh" as const }, |
| 209 | { label: "Newest", sort: "new" as const }, | |
| 209 | 210 | ]; |
| 210 | 211 | const windows = [ |
| 211 | 212 | { label: "Any time", updated: "all" as const }, |
src/web/style/content.ts +2
| @@ -176,6 +176,8 @@ a.origin-chip:hover { border-color: var(--border-strong); color: var(--fg); } | ||
| 176 | 176 | /* /explore (#9370): rows wrap rather than truncate a long name or description. */ |
| 177 | 177 | [data-explore] .row-title, [data-explore] .row-meta { white-space: normal; overflow: visible; } |
| 178 | 178 | [data-explore] .row { flex-wrap: wrap; } |
| 179 | /* Seven sort words are wider than a phone: wrap them, do not scroll inside the bar. */ | |
| 180 | [data-explore] .bar .seg { flex-wrap: wrap; overflow: visible; } | |
| 179 | 181 | [data-explore] .row-main { flex: 1 1 14rem; } |
| 180 | 182 | /* The forges pages (#9372): a row's trail of badges and buttons drops under its text on a phone and wraps. */ |
| 181 | 183 | [data-forges] .row-title, [data-forges] .row-meta { white-space: normal; overflow: visible; } |
test/explore-parity.test.ts +29 −8
| @@ -1,4 +1,7 @@ | ||
| 1 | /** One filter, one word: the page, the API and the MCP `explore` tool return the same ordered ids (#10387). */ | |
| 1 | /** | |
| 2 | * One filter, one word: the page, the API and the MCP `explore` tool return the same ordered ids | |
| 3 | * (#10387). | |
| 4 | */ | |
| 2 | 5 | import { afterAll, beforeAll, describe, expect, test } from "bun:test"; |
| 3 | 6 | import { mkdtemp, rm } from "node:fs/promises"; |
| 4 | 7 | import { tmpdir } from "node:os"; |
| @@ -51,7 +54,10 @@ afterAll(async () => { | ||
| 51 | 54 | |
| 52 | 55 | const DAY = 86_400_000; |
| 53 | 56 | |
| 54 | /** Signals that make every sort a different order: who is forked, shipped, liked, awake, fresh, and archived. */ | |
| 57 | /** | |
| 58 | * Signals that make every sort a different order: who is forked, shipped, liked, awake, fresh, and | |
| 59 | * archived. | |
| 60 | */ | |
| 55 | 61 | function seedSignals(): void { |
| 56 | 62 | const repoId = (owner: string, name: string): string => { |
| 57 | 63 | const row = app.db.query<{ id: string }, [string, string]>("SELECT repo.id AS id FROM repo JOIN user ON user.id = repo.owner_id WHERE user.username = ?1 AND repo.name = ?2").get(owner, name); |
| @@ -66,7 +72,8 @@ function seedSignals(): void { | ||
| 66 | 72 | fork(["pine", "kiln-pine"], ["olive", "loom-olive"]); |
| 67 | 73 | fork(["pine", "garden-pine"], ["olive", "loom-olive"]); |
| 68 | 74 | fork(["birch", "kiln-birch"], ["olive", "garden-olive"]); |
| 69 | // ships (merged pulls): garden-pine 3 (latest 5d ago), loom-birch 2 (latest 1d ago), kiln-olive 1 (45d ago, outside the window) | |
| 75 | // ships (merged pulls): garden-pine 3 (latest 5d ago), loom-birch 2 (latest 1d ago), kiln-olive 1 | |
| 76 | // (45d ago, outside the window) | |
| 70 | 77 | const ship = (r: [string, string], ago: number) => { |
| 71 | 78 | const issue = createIssue(app.db, { repoId: repoId(...r), authorId: owner, title: "change", kind: "pull" }); |
| 72 | 79 | if (!issue.ok) throw new Error(issue.error); |
| @@ -95,6 +102,14 @@ function seedSignals(): void { | ||
| 95 | 102 | awake(["pine", "kiln-pine"], 10); |
| 96 | 103 | awake(["olive", "garden-olive"], 5); |
| 97 | 104 | awake(["birch", "kiln-birch"], 2); |
| 105 | // made, newest first: kiln-pine 1h ago, loom-olive 2h, garden-birch 3h; the rest 30 days ago. A | |
| 106 | // person ranks by their newest app. | |
| 107 | const made = (r: [string, string], hoursAgo: number) => | |
| 108 | app.db.run("UPDATE repo SET created_at = ?1 WHERE id = ?2", [new Date(now - hoursAgo * 3_600_000).toISOString(), repoId(...r)]); | |
| 109 | for (const row of app.db.query<{ id: string }, []>("SELECT id FROM repo").all()) app.db.run("UPDATE repo SET created_at = ?1 WHERE id = ?2", [new Date(now - 30 * DAY).toISOString(), row.id]); | |
| 110 | made(["pine", "kiln-pine"], 1); | |
| 111 | made(["olive", "loom-olive"], 2); | |
| 112 | made(["birch", "garden-birch"], 3); | |
| 98 | 113 | // put away: loom-pine is only in archived:yes |
| 99 | 114 | app.db.run("UPDATE repo SET archived_at = ?1 WHERE id = ?2", [new Date(now).toISOString(), repoId("pine", "loom-pine")]); |
| 100 | 115 | } |
| @@ -119,7 +134,10 @@ const LINES = [ | ||
| 119 | 134 | "forks:0 ships:1 live:yes", |
| 120 | 135 | ]; |
| 121 | 136 | |
| 122 | /** The row links inside the page's `<ul class="list">`, in order: each row's title is the one link to its own url. */ | |
| 137 | /** | |
| 138 | * The row links inside the page's `<ul class="list">`, in order: each row's title is the one link | |
| 139 | * to its own url. | |
| 140 | */ | |
| 123 | 141 | function pageOrder(html: string): string[] { |
| 124 | 142 | const list = /<ul class="list">([\s\S]*?)<\/ul>/.exec(html); |
| 125 | 143 | if (list === null) return []; |
| @@ -139,7 +157,8 @@ async function mcp(line: string): Promise<{ ok: boolean; text: string }> { | ||
| 139 | 157 | } |
| 140 | 158 | |
| 141 | 159 | describe("one filter, three surfaces", () => { |
| 142 | // The orders the seeded signals must give, so a sort that ignores its signal (and falls back to name) fails. | |
| 160 | // The orders the seeded signals must give, so a sort that ignores its signal (and falls back to | |
| 161 | // name) fails. | |
| 143 | 162 | const EXPECTED: Record<string, string[]> = { |
| 144 | 163 | "kind:app sort:forks": ["olive/loom-olive", "olive/garden-olive"], |
| 145 | 164 | "kind:app sort:ships": ["pine/garden-pine", "birch/loom-birch"], |
| @@ -147,6 +166,8 @@ describe("one filter, three surfaces", () => { | ||
| 147 | 166 | "kind:app sort:use": ["pine/kiln-pine", "olive/garden-olive", "birch/kiln-birch"], |
| 148 | 167 | "kind:app sort:fresh": ["birch/loom-birch", "pine/garden-pine", "olive/kiln-olive"], |
| 149 | 168 | "kind:app sort:name": ["birch/garden-birch", "birch/kiln-birch", "birch/loom-birch", "olive/garden-olive", "olive/kiln-olive", "olive/loom-olive", "pine/garden-pine", "pine/kiln-pine"], |
| 169 | "kind:app sort:new": ["pine/kiln-pine", "olive/loom-olive", "birch/garden-birch"], | |
| 170 | "kind:person sort:new": ["pine", "olive", "birch"], | |
| 150 | 171 | "kind:person sort:forks": ["olive"], |
| 151 | 172 | "kind:app updated:7d": ["pine/garden-pine", "birch/loom-birch"], |
| 152 | 173 | "kind:app archived:yes sort:name": ["birch/garden-birch", "birch/kiln-birch", "birch/loom-birch", "olive/garden-olive", "olive/kiln-olive", "olive/loom-olive", "pine/garden-pine", "pine/kiln-pine", "pine/loom-pine"], |
| @@ -247,13 +268,13 @@ describe("one filter, three surfaces", () => { | ||
| 247 | 268 | expect(api.status).toBe(400); |
| 248 | 269 | const body = (await api.json()) as { error: string; message: string }; |
| 249 | 270 | expect(body.error).toBe("unknown_filter"); |
| 250 | expect(body.message).toContain("use score, forks, ships, likes, use, fresh, name"); | |
| 271 | expect(body.message).toContain("use score, forks, ships, likes, use, fresh, new, name"); | |
| 251 | 272 | const tool = await mcp("sort:bogus"); |
| 252 | 273 | expect(tool.ok).toBe(false); |
| 253 | expect(tool.text).toContain("use score, forks, ships, likes, use, fresh, name"); | |
| 274 | expect(tool.text).toContain("use score, forks, ships, likes, use, fresh, new, name"); | |
| 254 | 275 | const page = await fetch(`${servers.url}/explore?q=${q}`); |
| 255 | 276 | expect(page.status).toBe(200); |
| 256 | expect(await page.text()).toContain("use score, forks, ships, likes, use, fresh, name"); | |
| 277 | expect(await page.text()).toContain("use score, forks, ships, likes, use, fresh, new, name"); | |
| 257 | 278 | for (const bad of ["kind:x", "updated:2y", "archived:maybe"]) { |
| 258 | 279 | expect((await fetch(`${servers.url}/api/v1/explore?q=${encodeURIComponent(bad)}`)).status).toBe(400); |
| 259 | 280 | } |
test/explore-sort.test.ts +39
| @@ -16,9 +16,11 @@ import { promote } from "./helpers/members.ts"; | ||
| 16 | 16 | quietLogs(); |
| 17 | 17 | const DAY = 86_400_000; |
| 18 | 18 | const HOUR = 3_600_000; |
| 19 | const DEFAULT_ORDER = ["/olive/loom", "/olive/garden", "/olive/kiln", "/olive/zed"]; | |
| 19 | 20 | let dir: string; |
| 20 | 21 | let app: App; |
| 21 | 22 | let servers: Servers; |
| 23 | let olive: Awaited<ReturnType<typeof createUser>> extends infer R ? R extends { ok: true; value: infer V } ? V : never : never; | |
| 22 | 24 | |
| 23 | 25 | // newest ships: kiln (1 day), garden (10), loom (20). most used: loom (200 h), garden (50), kiln |
| 24 | 26 | // (1). |
| @@ -28,6 +30,7 @@ beforeAll(async () => { | ||
| 28 | 30 | const made = await createUser(app.db, { origin: "seed", username: "olive", email: "[email protected]", password: "a-good-passphrase", adminIfFirst: false }); |
| 29 | 31 | if (!made.ok) throw new Error(made.error); |
| 30 | 32 | proveAll(app); |
| 33 | olive = made.value; | |
| 31 | 34 | promote(app.db, made.value); |
| 32 | 35 | const now = Date.now(); |
| 33 | 36 | for (const [name, shipDays, hours] of [["garden", 10, 50], ["kiln", 1, 1], ["loom", 20, 200]] as const) { |
| @@ -94,3 +97,39 @@ test("an unknown sort falls back to the default with a note, never a 500", async | ||
| 94 | 97 | expect(bad.html).toContain("is not a sort"); |
| 95 | 98 | expect(bad.html).not.toMatch(/aria-current="[^"]+"[^>]*>\s*Fresh\s*</); |
| 96 | 99 | }); |
| 100 | ||
| 101 | test("sort=new puts the most recently made app first, and its link is marked", async () => { | |
| 102 | // Make `zed` last, so it is newest though it never shipped. | |
| 103 | const repo = await createRepo(app, olive, { name: "zed", visibility: "public" }); | |
| 104 | if (!repo.ok) throw new Error(String(repo.error)); | |
| 105 | insertApp(app.db, { repoId: repo.value.id, slug: "olive-zed", access: "public" }); | |
| 106 | app.db.query("UPDATE repo SET created_at = ?1 WHERE id = ?2").run(new Date(Date.now() + HOUR).toISOString(), repo.value.id); | |
| 107 | const res = await get("?kind=app&sort=new"); | |
| 108 | expect(listed(res.html)[0]).toBe("/olive/zed"); | |
| 109 | expect(res.html).toMatch(/<a[^>]*aria-current="[^"]+"[^>]*>\s*Newest\s*<\/a>/); | |
| 110 | // Without a sort, the order is the score's, and zed (no ships, no use) is last. | |
| 111 | expect(listed((await get("?kind=app")).html)).toEqual(DEFAULT_ORDER); | |
| 112 | }); | |
outdated
Weak: this passes for any order that does not start with zed. Assert the exact default order. Also add a person-sort assertion for the newest-app rule. |
||
| 113 | ||
| 114 | test("sort=new ranks a person by their newest app, not by the order of their apps", async () => { | |
| 115 | const amber = await createUser(app.db, { origin: "seed", username: "amber", email: "[email protected]", password: "a-good-passphrase", adminIfFirst: false }); | |
| 116 | if (!amber.ok) throw new Error(amber.error); | |
| 117 | proveAll(app); | |
| 118 | promote(app.db, amber.value); | |
| 119 | // One app far older than anything, one newer than olive's newest (zed, +1 h). | |
| 120 | for (const [name, at] of [["relic", -10 * DAY], ["fresh", 3 * HOUR]] as const) { | |
| 121 | const repo = await createRepo(app, amber.value, { name, visibility: "public" }); | |
| 122 | if (!repo.ok) throw new Error(String(repo.error)); | |
| 123 | insertApp(app.db, { repoId: repo.value.id, slug: `amber-${name}`, access: "public" }); | |
| 124 | app.db.query("UPDATE repo SET created_at = ?1 WHERE id = ?2").run(new Date(Date.now() + at).toISOString(), repo.value.id); | |
| 125 | } | |
| 126 | const res = await get("?kind=person&sort=new"); | |
| 127 | expect(listed(res.html).slice(0, 2)).toEqual(["/amber", "/olive"]); | |
| 128 | }); | |
| 129 | ||
| 130 | test("sort=forks is accepted and marked, and the kind links keep it", async () => { | |
| 131 | const res = await get("?kind=app&sort=forks"); | |
| 132 | expect(res.status).toBe(200); | |
| 133 | expect(res.html).toMatch(/<a[^>]*aria-current="[^"]+"[^>]*>\s*Forks\s*<\/a>/); | |
| 134 | expect(link(res.html, "People")).toContain("sort=forks"); | |
| 135 | }); |
test/explore-unknown-words.test.ts +3 −3
| @@ -82,7 +82,7 @@ describe("readExploreLine", () => { | ||
| 82 | 82 | }); |
| 83 | 83 | |
| 84 | 84 | test("the note names what is taken", () => { |
| 85 | expect(exploreNote(["sort:bogus"])).toBe("sort:bogus is not a sort — use score, forks, ships, likes, use, fresh, name"); | |
| 85 | expect(exploreNote(["sort:bogus"])).toBe("sort:bogus is not a sort — use score, forks, ships, likes, use, fresh, new, name"); | |
| 86 | 86 | expect(exploreNote(["kind:x"])).toBe("kind:x is not a kind — use app, person, forge"); |
| 87 | 87 | }); |
| 88 | 88 | }); |
| @@ -106,7 +106,7 @@ describe("the page and the API", () => { | ||
| 106 | 106 | const q = encodeURIComponent("sort:bogus garden"); |
| 107 | 107 | const out = await (await fetch(`${servers.url}/explore?q=${q}`)).text(); |
| 108 | 108 | expect(out.split("is not a sort").length).toBe(2); |
| 109 | expect(out).toContain("sort:bogus is not a sort — use score, forks, ships, likes, use, fresh, name"); | |
| 109 | expect(out).toContain("sort:bogus is not a sort — use score, forks, ships, likes, use, fresh, new, name"); | |
| 110 | 110 | expect(out).not.toContain(encodeURIComponent("sort:bogus")); |
| 111 | 111 | expect(out).toContain(`href="${linkOf("kind:app garden")}"`); |
| 112 | 112 | }); |
| @@ -160,7 +160,7 @@ describe("the page and the API", () => { | ||
| 160 | 160 | }; |
| 161 | 161 | const sort = await call("sort:bogus"); |
| 162 | 162 | expect(sort.isError).toBe(true); |
| 163 | expect(sort.text).toContain("unknown_filter: sort:bogus is not a sort — use score, forks, ships, likes, use, fresh, name"); | |
| 163 | expect(sort.text).toContain("unknown_filter: sort:bogus is not a sort — use score, forks, ships, likes, use, fresh, new, name"); | |
| 164 | 164 | const fine = await call("sort:forks"); |
| 165 | 165 | expect(fine.isError).toBe(false); |
| 166 | 166 | expect(JSON.parse(fine.text)).toHaveProperty("items"); |
new above
offline
The person's newest-app rule has no test. Add one that fails if this line is removed.