SpellGrid capstone: Part I's card engine and Part II's grid engine joined at three seams (rules -> aura data, hazard victims -> one destroy Sequence, Sequence end -> write text, remove the dead, reparse). Three levels with scripted solutions, a naive-timing test via a harness-only hook that reverses the END_OF_PHASE list, CLIs in both tracks, the BATTLECRY IS DOUBLE Expansion Drop, SpellGrid cards and words in course/cards and the catalog, level schema cards/hand, and tools staging/copying of module levels. Co-Authored-By: Claude Opus 5.5 <[email protected]>
65 lines
2.3 KiB
JavaScript
65 lines
2.3 KiB
JavaScript
import { test } from "node:test";
|
|
import assert from "node:assert/strict";
|
|
import { existsSync, mkdirSync, writeFileSync } from "node:fs";
|
|
import { join } from "node:path";
|
|
import { run, copyFixture, fixtures } from "./helpers.mjs";
|
|
|
|
const env = { COURSE_ROOT: join(fixtures, "course") };
|
|
|
|
test("start_module_copies_tests", () => {
|
|
const ws = copyFixture("ws-start");
|
|
const r = run("start-module.mjs", ["01", ws], env);
|
|
assert.equal(r.code, 0, r.out);
|
|
assert.ok(existsSync(join(ws, "tests/m01.rs")));
|
|
assert.match(r.out, /newGame, summon, play/);
|
|
});
|
|
|
|
test("start_module_copies_course_cards", () => {
|
|
const ws = copyFixture("ws-start");
|
|
const r = run("start-module.mjs", ["01", ws], env);
|
|
assert.equal(r.code, 0, r.out);
|
|
assert.ok(existsSync(join(ws, "cards/test-fixture.json")));
|
|
});
|
|
|
|
test("start_module_copies_module_levels", () => {
|
|
const ws = copyFixture("ws-start");
|
|
mkdirSync(join(ws, "tests"), { recursive: true });
|
|
writeFileSync(join(ws, "tests/m02.rs"), "");
|
|
const r = run("start-module.mjs", ["03", ws], env);
|
|
assert.equal(r.code, 0, r.out);
|
|
assert.ok(existsSync(join(ws, "levels/fixture-level.json")));
|
|
});
|
|
|
|
test("start_module_uses_track", () => {
|
|
const ws = copyFixture("ws-start-ts");
|
|
assert.equal(run("start-module.mjs", ["01", ws], env).code, 0);
|
|
assert.ok(existsSync(join(ws, "tests/m01.test.ts")));
|
|
assert.ok(!existsSync(join(ws, "tests/m01.rs")));
|
|
});
|
|
|
|
test("start_module_accepts_when_previous_present", () => {
|
|
const ws = copyFixture("ws-start");
|
|
mkdirSync(join(ws, "tests"), { recursive: true });
|
|
writeFileSync(join(ws, "tests/m02.rs"), "");
|
|
const r = run("start-module.mjs", ["03", ws], env);
|
|
assert.equal(r.code, 0, r.out);
|
|
assert.ok(existsSync(join(ws, "tests/m03.rs")));
|
|
});
|
|
|
|
test("start_module_refuses_skipping", () => {
|
|
const ws = copyFixture("ws-start");
|
|
mkdirSync(join(ws, "tests"), { recursive: true });
|
|
writeFileSync(join(ws, "tests/m01.rs"), "");
|
|
const r = run("start-module.mjs", ["03", ws], env);
|
|
assert.equal(r.code, 1);
|
|
assert.match(r.out, /finish module 02 first/);
|
|
assert.ok(!existsSync(join(ws, "tests/m03.rs")));
|
|
});
|
|
|
|
test("start_module_00_not_startable", () => {
|
|
const ws = copyFixture("ws-start");
|
|
const r = run("start-module.mjs", ["00", ws], env);
|
|
assert.notEqual(r.code, 0);
|
|
assert.match(r.out, /naive-engine/);
|
|
});
|