44 lines · 2.4 KB · TypeScriptRaw
/** * RULE (TABLE DROP 1, coordinator, 27 Nov 2026): the acts of the retired apps Money, Podcasts and Music stay * registered, and each is refused by name — 410 retired, the sentence naming its app — never unknown; and a download * landing a song (Music's table) is refused the same way. */import { describe, expect, it } from "vitest";import { FILMS_OPEN, http, personalObject } from "./personal.ts";async function act(slug: string, credential: string, name: string, args: Record<string, unknown> = {}) { return http<Record<string, unknown>>(slug, "POST", "/v1/act", { act: name, args }, { authorization: `Bearer ${credential}` });}const RETIRED: Record<string, string[]> = { Money: ["read_statement", "submit_statement_reading", "book_statement", "settle_expected", "match_external", "merge_accounts"], Podcasts: ["subscribe_podcast", "refresh_podcast", "import_opml", "export_opml"], Music: ["fetch_cover", "find_lyrics", "drop_old_music"],};describe("a retired app's act", () => { for (const [app, acts] of Object.entries(RETIRED)) { it(`${app}: each act answers 410 retired, naming ${app}`, async () => { const slug = `retired-acts-${app.toLowerCase()}`; const { credential } = await personalObject(slug); for (const name of acts) { const res = await act(slug, credential, name, {}); expect([res.status, res.body.code], `${name}: ${JSON.stringify(res.body)}`).toEqual([410, "retired"]); expect(String(res.body.message), name).toBe(`${app} is retired: its tables are no longer served`); } }); } it("Fetch: a download landing a song answers 410 retired, naming Music", async () => { const slug = "retired-acts-fetch-song"; const { credential, owner } = await personalObject(slug, { open: [...FILMS_OPEN.open, "fetch", "fetch_file"] }); const added = await act(slug, credential, "fetch_add", { source: "https://video.example/watch?v=invented02", wants: "audio" }); expect(added.status, JSON.stringify(added.body)).toBe(200); const id = String(added.body.fetch); expect((await act(slug, owner, "fetch_claim", { id, machine: "m-invented" })).status).toBe(200); const landed = await act(slug, owner, "fetch_landed", { id, landed: [{ table: "song", id: "song-invented" }] }); expect([landed.status, landed.body.code], JSON.stringify(landed.body)).toEqual([410, "retired"]); expect(String(landed.body.message)).toBe("Music is retired: its tables are no longer served"); });});