syntaxai/tdd.md · commit eaf6031

red: spec parser returns kata steps in order

Asserts loadGame("string-calc") yields the seven step ids in their
authored order. Game type gains a Step[] field; the implementation
still returns [] so the test fails on the diff. Next green will load
the real spec from content/games/<id>/spec.ts.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
author
syntaxai <[email protected]>
date
2026-05-03 16:33:14 +01:00
parent
3bb73b2
commit
eaf60318d6e1b7243de3eddac167bc81ef5413ca

2 files changed · +19 −1

modified src/games.test.ts +13 −0
@@ -5,3 +5,16 @@ test("loadGame returns a game with the expected id", async () => {
55 const game = await loadGame("string-calc");
66 expect(game.id).toBe("string-calc");
77 });
8+
9+test("loadGame returns the kata's step ids in order", async () => {
10+ const game = await loadGame("string-calc");
11+ expect(game.steps.map((s) => s.id)).toEqual([
12+ "empty",
13+ "single-number",
14+ "two-numbers",
15+ "n-numbers",
16+ "newline-separator",
17+ "custom-separator",
18+ "negatives-throw",
19+ ]);
20+});
modified src/games.ts +6 −1
@@ -1,7 +1,12 @@
1+export interface Step {
2+ id: string;
3+}
4+
15 export interface Game {
26 id: string;
7+ steps: Step[];
38 }
49
510 export async function loadGame(id: string): Promise<Game> {
6- return { id };
11+ return { id, steps: [] };
712 }