Files
HexTrails/labs/hex-video/tests/hex-video-lab.test.js
T
cabinw e92cccba82 feat: version campaigns and document original puzzle design
Restore v0.1 and v0.2 archives with separate progress, publish the curved v0.3 campaign, and document the original 24-level design with reproducible evidence. Refine board presentation and movement, and keep video lab tooling within its own directory.
2026-09-09 13:17:30 +08:00

22 lines
864 B
JavaScript

import test from 'node:test';
import assert from 'node:assert/strict';
import { Game, solve, validateLevel } from '../../../src/core.js';
import { makeLabLevel } from '../fixture.js';
test('video lab fixture validates and can complete through real game actions', () => {
const level = makeLabLevel();
assert.deepEqual(validateLevel(level), []);
assert.equal(level.tiles.length, 18);
const solution = solve(level), game = new Game(level);
assert.equal(solution.solvable, true);
const blocked = game.tap('lab-0');
assert.equal(blocked.status, 'blocked');
assert.equal(game.moves, level.moveLimit);
for (const id of solution.order) assert.equal(game.tap(id).status, 'exit');
assert.equal(game.won, true);
assert.equal(game.moves, 0);
assert.equal(game.undo(), true);
assert.equal(game.won, false);
assert.equal(game.tiles.length, 1);
});