From 89375e9acec90cd717c6f716ae15bf35eaa5a51a Mon Sep 17 00:00:00 2001 From: Alain Schlesser Date: Sun, 15 Nov 2026 22:00:56 +0000 Subject: [PATCH] test(modules): finish Odysseus fixture migration --- .changeset/odysseus-finance-example.md | 5 +++ packages/module-finance/templates/ledger.md | 2 +- packages/module-finance/tests/finance.test.ts | 38 +++++++++---------- .../{acme-corp => ithaca-fleet}/ledger.md | 14 +++---- .../{initech => ithaca-shipwrights}/ledger.md | 8 ++-- .../{globex => phaeacian-fleet}/ledger.md | 10 ++--- .../tests/file-link-detection.test.ts | 6 +-- .../ui-server/tests/backend-registry.test.ts | 6 +-- 8 files changed, 47 insertions(+), 42 deletions(-) create mode 100644 .changeset/odysseus-finance-example.md rename packages/module-finance/tests/fixtures/clients/{acme-corp => ithaca-fleet}/ledger.md (74%) rename packages/module-finance/tests/fixtures/clients/{initech => ithaca-shipwrights}/ledger.md (71%) rename packages/module-finance/tests/fixtures/clients/{globex => phaeacian-fleet}/ledger.md (74%) diff --git a/.changeset/odysseus-finance-example.md b/.changeset/odysseus-finance-example.md new file mode 100644 index 0000000000..4ccc16ee18 --- /dev/null +++ b/.changeset/odysseus-finance-example.md @@ -0,0 +1,5 @@ +--- +"@schlessera/brain-module-finance": patch +--- + +Use an Odysseus-world legal-name example in the starter ledger comment. diff --git a/packages/module-finance/templates/ledger.md b/packages/module-finance/templates/ledger.md index fc6a9c98b4..e8d0be2e27 100644 --- a/packages/module-finance/templates/ledger.md +++ b/packages/module-finance/templates/ledger.md @@ -7,7 +7,7 @@ type: finance client: __SLUG__ # stable slug; must match the directory name display_name: __DISPLAY__ # human-readable name shown in reports -# legal_name: Acme Corporation LLC # optional; full legal entity name +# legal_name: Ithaca Fleet # optional; full legal entity name currency: __CURRENCY__ # ISO code; drives money formatting (USD/EUR special-cased) status: active # free-form label: active | inactive | archived terms_days: __TERMS__ # payment terms in days; overdue = issued + terms_days diff --git a/packages/module-finance/tests/finance.test.ts b/packages/module-finance/tests/finance.test.ts index d1379536e9..cb12bb2f70 100644 --- a/packages/module-finance/tests/finance.test.ts +++ b/packages/module-finance/tests/finance.test.ts @@ -39,13 +39,13 @@ function reportFor(slug: string) { describe("ledger computation", () => { test("loads all fixture ledgers", () => { const ledgers = loadLedgers(OPTS); - expect(ledgers.map((l) => l.slug).sort()).toEqual(["acme-corp", "globex", "initech"]); + expect(ledgers.map((l) => l.slug).sort()).toEqual(["ithaca-fleet", "ithaca-shipwrights", "phaeacian-fleet"]); }); test("partial payment leaves the invoice partial with the right open balance", () => { - const c = reportFor("acme-corp"); - const inv01 = c.invoices.find((i) => i.number === "2026-acme-corp-01")!; - const inv02 = c.invoices.find((i) => i.number === "2026-acme-corp-02")!; + const c = reportFor("ithaca-fleet"); + const inv01 = c.invoices.find((i) => i.number === "2026-ithaca-fleet-01")!; + const inv02 = c.invoices.find((i) => i.number === "2026-ithaca-fleet-02")!; expect(inv01.status).toBe("paid"); expect(inv01.open).toBe(0); expect(inv02.status).toBe("partial"); @@ -55,7 +55,7 @@ describe("ledger computation", () => { }); test("a shortfall within fee tolerance settles the invoice as paid", () => { - const c = reportFor("globex"); + const c = reportFor("phaeacian-fleet"); const inv = c.invoices[0]; expect(inv.paid).toBe(975); expect(inv.open).toBe(0); @@ -64,14 +64,14 @@ describe("ledger computation", () => { }); test("a shortfall above fee tolerance stays open", () => { - const ledger = loadLedgers(OPTS, "globex")[0]; + const ledger = loadLedgers(OPTS, "phaeacian-fleet")[0]; const strict = computeClient(ledger, 10, AS_OF); // tolerance below the 25 shortfall expect(strict.invoices[0].open).toBe(25); expect(strict.invoices[0].status).toBe("partial"); }); test("a written_off invoice carries the written_off status", () => { - const c = reportFor("initech"); + const c = reportFor("ithaca-shipwrights"); expect(c.invoices[0].status).toBe("written_off"); }); }); @@ -129,20 +129,20 @@ describe("the generated region (#403)", () => { test("a ledger carrying the old markers is rewritten to core's region, with today's tables", () => { const root = copyFixtures(); try { - const path = join(root, "clients/acme-corp/ledger.md"); + const path = join(root, "clients/ithaca-fleet/ledger.md"); const prose = "Hand-written notes that must survive."; writeFileSync(path, `${readFileSync(path, "utf8").trimEnd()}\n\n${prose}\n\n${LEGACY_BEGIN}\n\nold table\n\n${LEGACY_END}\n\nClosing words.\n`); const opts = { ...OPTS, root }; const { files } = syncFiles(opts, AS_OF); - expect(files).toContain("clients/acme-corp/ledger.md"); + expect(files).toContain("clients/ithaca-fleet/ledger.md"); const body = readFileSync(path, "utf8"); expect(body).not.toContain("BEGIN GENERATED"); expect(body).not.toContain("old table"); expect(body).toContain(`${prose}\n\n`); expect(body).toContain("\n\nClosing words.\n"); - const ledger = loadLedgers(opts, "acme-corp")[0]; + const ledger = loadLedgers(opts, "ithaca-fleet")[0]; const expected = renderLedgerTables(computeClient(ledger, opts.feeTolerance, AS_OF), ledger.payments); expect(expected.length).toBeGreaterThan(0); expect(readGeneratedRegion(body, "finance")).toBe(expected); @@ -161,22 +161,22 @@ describe("the generated region (#403)", () => { test("frontmatter text that looks like a marker, a pipe or a line break stays inside its cell, on the ledger and the dashboard", () => { const root = copyFixtures(); try { - const ledger = join(root, "clients/acme-corp/ledger.md"); + const ledger = join(root, "clients/ithaca-fleet/ledger.md"); const CLOSE = ""; writeFileSync( ledger, readFileSync(ledger, "utf8") - .replace("display_name: Acme Corporation", `display_name: "Acme | Corp\\n${CLOSE}"`) - .replace("client: acme-corp", `client: "acme-corp\\n${CLOSE}\\n(x)"`) - .replace("number: 2026-acme-corp-01", 'number: "2026-acme|01"') - .replace("invoice: 2026-acme-corp-01", 'invoice: "2026-acme|01"') + .replace("display_name: Ithaca Fleet", `display_name: "Ithaca | Fleet\\n${CLOSE}"`) + .replace("client: ithaca-fleet", `client: "ithaca-fleet\\n${CLOSE}\\n(x)"`) + .replace("number: 2026-ithaca-fleet-01", 'number: "2026-ithaca|01"') + .replace("invoice: 2026-ithaca-fleet-01", 'invoice: "2026-ithaca|01"') .replace("method: wire", `method: "wire\\n${CLOSE}\\nrest"`) ); const dashboard = join(root, "clients/_index.md"); writeFileSync(dashboard, "---\ntype: index\ntitle: Clients\nupdated: 2026-01-01\n---\n\n# Clients\n"); const opts = { ...OPTS, root }; - expect(syncFiles(opts, AS_OF).files.sort()).toContain("clients/acme-corp/ledger.md"); + expect(syncFiles(opts, AS_OF).files.sort()).toContain("clients/ithaca-fleet/ledger.md"); for (const path of [ledger, dashboard]) { const text = readFileSync(path, "utf8"); const markerLines = text.split("\n").filter((line) => line.trim().startsWith(" rest"); - expect(readGeneratedRegion(readFileSync(ledger, "utf8"), "finance")).toContain("| 2026-acme\\|01 |"); - expect(readGeneratedRegion(readFileSync(dashboard, "utf8"), "finance")).toContain("Acme \\| Corp <!--"); + expect(readGeneratedRegion(readFileSync(ledger, "utf8"), "finance")).toContain("| 2026-ithaca\\|01 |"); + expect(readGeneratedRegion(readFileSync(dashboard, "utf8"), "finance")).toContain("Ithaca \\| Fleet <!--"); // The client directory is a link destination: percent-encoded, not escaped. - expect(readGeneratedRegion(readFileSync(dashboard, "utf8"), "finance")).toContain("](acme-corp%0A%3C!--%20%2Fbrain%3Agenerated%3Afinance%20--%3E%0A(x)/)"); + expect(readGeneratedRegion(readFileSync(dashboard, "utf8"), "finance")).toContain("](ithaca-fleet%0A%3C!--%20%2Fbrain%3Agenerated%3Afinance%20--%3E%0A(x)/)"); // A second sync reads its own output back and writes nothing. expect(syncFiles(opts, AS_OF).files).toEqual([]); } finally { diff --git a/packages/module-finance/tests/fixtures/clients/acme-corp/ledger.md b/packages/module-finance/tests/fixtures/clients/ithaca-fleet/ledger.md similarity index 74% rename from packages/module-finance/tests/fixtures/clients/acme-corp/ledger.md rename to packages/module-finance/tests/fixtures/clients/ithaca-fleet/ledger.md index d78374ed64..5811b11e6e 100644 --- a/packages/module-finance/tests/fixtures/clients/acme-corp/ledger.md +++ b/packages/module-finance/tests/fixtures/clients/ithaca-fleet/ledger.md @@ -1,20 +1,20 @@ --- type: finance -client: acme-corp -display_name: Acme Corporation +client: ithaca-fleet +display_name: Ithaca Fleet currency: USD status: active terms_days: 30 created: 2026-01-01 updated: 2026-01-01 invoices: - - number: 2026-acme-corp-01 + - number: 2026-ithaca-fleet-01 period: 2026-01 issued: 2026-01-15 hours: 40 amount: 4000 note: Fully paid. - - number: 2026-acme-corp-02 + - number: 2026-ithaca-fleet-02 period: 2026-01 issued: 2026-01-15 hours: 20 @@ -26,17 +26,17 @@ payments: fee: 0 method: wire allocations: - - invoice: 2026-acme-corp-01 + - invoice: 2026-ithaca-fleet-01 amount: 4000 - date: 2026-01-25 received: 1000 fee: 0 method: wire allocations: - - invoice: 2026-acme-corp-02 + - invoice: 2026-ithaca-fleet-02 amount: 1000 --- -# Acme Corporation +# Ithaca Fleet Fixture ledger: one fully paid invoice and one partially paid invoice. diff --git a/packages/module-finance/tests/fixtures/clients/initech/ledger.md b/packages/module-finance/tests/fixtures/clients/ithaca-shipwrights/ledger.md similarity index 71% rename from packages/module-finance/tests/fixtures/clients/initech/ledger.md rename to packages/module-finance/tests/fixtures/clients/ithaca-shipwrights/ledger.md index 2d85614ea7..d315f24785 100644 --- a/packages/module-finance/tests/fixtures/clients/initech/ledger.md +++ b/packages/module-finance/tests/fixtures/clients/ithaca-shipwrights/ledger.md @@ -1,14 +1,14 @@ --- type: finance -client: initech -display_name: Initech +client: ithaca-shipwrights +display_name: Ithaca Shipwrights currency: EUR status: active terms_days: 30 created: 2026-01-01 updated: 2026-01-01 invoices: - - number: 2026-initech-01 + - number: 2026-ithaca-shipwrights-01 period: 2026-01 issued: 2026-01-05 amount: 5000 @@ -17,6 +17,6 @@ invoices: payments: [] --- -# Initech +# Ithaca Shipwrights Fixture ledger: a single written-off invoice. diff --git a/packages/module-finance/tests/fixtures/clients/globex/ledger.md b/packages/module-finance/tests/fixtures/clients/phaeacian-fleet/ledger.md similarity index 74% rename from packages/module-finance/tests/fixtures/clients/globex/ledger.md rename to packages/module-finance/tests/fixtures/clients/phaeacian-fleet/ledger.md index 52eca2c6aa..2ff4fe78e5 100644 --- a/packages/module-finance/tests/fixtures/clients/globex/ledger.md +++ b/packages/module-finance/tests/fixtures/clients/phaeacian-fleet/ledger.md @@ -1,14 +1,14 @@ --- type: finance -client: globex -display_name: Globex +client: phaeacian-fleet +display_name: Phaeacian Fleet currency: USD status: active terms_days: 30 created: 2026-01-01 updated: 2026-01-01 invoices: - - number: 2026-globex-01 + - number: 2026-phaeacian-fleet-01 period: 2026-01 issued: 2026-01-10 amount: 1000 @@ -19,10 +19,10 @@ payments: fee: 0 method: wire allocations: - - invoice: 2026-globex-01 + - invoice: 2026-phaeacian-fleet-01 amount: 975 --- -# Globex +# Phaeacian Fleet Fixture ledger: a 25.00 shortfall that the fee-tolerance rule zeroes out. diff --git a/packages/ui-react/tests/file-link-detection.test.ts b/packages/ui-react/tests/file-link-detection.test.ts index 85b9de0a48..d2bb6e9723 100644 --- a/packages/ui-react/tests/file-link-detection.test.ts +++ b/packages/ui-react/tests/file-link-detection.test.ts @@ -176,12 +176,12 @@ describe("entity-tag + bare-path interaction", () => { }); test("entity content without a path stays as plain text", () => { - const md = renderEntityTags("Met Acme today."); + const md = renderEntityTags("Met Ithaca Fleet today."); const tokens = tokenize(md, true, true); const entity = tokens.find((t) => t.type === "entity"); if (entity?.type !== "entity") throw new Error("not entity"); expect(entity.tag).toBe("co"); - expect(entity.inner).toEqual([{ type: "text", value: "Acme" }]); + expect(entity.inner).toEqual([{ type: "text", value: "Ithaca Fleet" }]); }); test("entity content with mixed text and path", () => { @@ -198,7 +198,7 @@ describe("entity-tag + bare-path interaction", () => { }); test("top-level text outside entity tags is still linkified", () => { - const md = renderEntityTags("From notes/a.md to Acme."); + const md = renderEntityTags("From notes/a.md to Ithaca Fleet."); const tokens = tokenize(md, true, true); expect(tokens[0]).toEqual({ type: "text", value: "From " }); expect(tokens[1]).toEqual({ type: "path", value: "notes/a.md" }); diff --git a/packages/ui-server/tests/backend-registry.test.ts b/packages/ui-server/tests/backend-registry.test.ts index 7404c1e1f7..83faf92735 100644 --- a/packages/ui-server/tests/backend-registry.test.ts +++ b/packages/ui-server/tests/backend-registry.test.ts @@ -583,10 +583,10 @@ describe("static registry (test/embedder seam)", () => { test("keeps a by-value descriptor resolution's hooks and model source", async () => { const backend = makeFakeBackend({ id: "custom", - profiles: [{ id: "custom-pro", label: "Custom Pro", vendor: "acme" }], + profiles: [{ id: "custom-pro", label: "Custom Pro", vendor: "ithaca" }], }); const modelSource: BackendModelSource = { - list: () => [{ id: "custom-pro", label: "Custom Pro", vendor: "acme" }], + list: () => [{ id: "custom-pro", label: "Custom Pro", vendor: "ithaca" }], state: () => ({ enabled: true, refreshedAt: 1, stale: false }), ensureFresh: async () => {}, refresh: async () => {}, @@ -598,7 +598,7 @@ describe("static registry (test/embedder seam)", () => { parse() { return { ok: true, - profiles: [{ id: "custom-pro", label: "Custom Pro", vendor: "acme" }], + profiles: [{ id: "custom-pro", label: "Custom Pro", vendor: "ithaca" }], }; }, },