red: spec parser surfaces unknown games clearly
Asserts loadGame("does-not-exist") rejects with a message matching
/unknown game: does-not-exist/. Currently the dynamic import leaks
"Cannot find module ../content/games/does-not-exist/spec.ts ..." which
is implementation-detail garbage. Next green will catch the import
miss and throw a clean, identity-shaped error.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
1 file changed · +6 −0
src/games.test.ts
+6
−0
| @@ -18,3 +18,9 @@ test("loadGame returns the kata's step ids in order", async () => { | ||
| 18 | 18 | "negatives-throw", |
| 19 | 19 | ]); |
| 20 | 20 | }); |
| 21 | + | |
| 22 | +test("loadGame throws a clear error for an unknown game", async () => { | |
| 23 | + await expect(loadGame("does-not-exist")).rejects.toThrow( | |
| 24 | + /unknown game: does-not-exist/, | |
| 25 | + ); | |
| 26 | +}); | |