mirror of
https://github.com/profullstack/logicsrc.git
synced 2026-08-13 22:37:29 +00:00
Handle empty arcade game lists (#38)
Co-authored-by: Codex Microtask Operator <codex-microtask@example.com>
This commit is contained in:
parent
3afda8c147
commit
ad3926a006
2 changed files with 9 additions and 1 deletions
8
packages/tui/src/arcade/registry.test.ts
Normal file
8
packages/tui/src/arcade/registry.test.ts
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
import { describe, expect, it } from "vitest";
|
||||||
|
import { ArcadeRegistry, renderArcadeList } from "./registry.js";
|
||||||
|
|
||||||
|
describe("arcade registry", () => {
|
||||||
|
it("renders an empty arcade list without throwing", () => {
|
||||||
|
expect(renderArcadeList(new ArcadeRegistry())).toContain("No games registered");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
@ -70,6 +70,6 @@ export function renderArcadeList(registry = createDefaultArcadeRegistry()) {
|
||||||
"",
|
"",
|
||||||
`${"id".padEnd(idWidth)} ${"title".padEnd(titleWidth)} description`,
|
`${"id".padEnd(idWidth)} ${"title".padEnd(titleWidth)} description`,
|
||||||
`${"-".repeat(idWidth)} ${"-".repeat(titleWidth)} ${"-".repeat(40)}`,
|
`${"-".repeat(idWidth)} ${"-".repeat(titleWidth)} ${"-".repeat(40)}`,
|
||||||
...rows.map((row) => `${row.id.padEnd(idWidth)} ${row.title.padEnd(titleWidth)} ${row.description}`)
|
...(rows.length ? rows.map((row) => `${row.id.padEnd(idWidth)} ${row.title.padEnd(titleWidth)} ${row.description}`) : ["No games registered"])
|
||||||
].join("\n");
|
].join("\n");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue