1import test from 'node:test';2import assert from 'node:assert/strict';3import { checkLevel } from '../src/solver/check-level.js';45const walkLevel = metadata => ({6 id: 'walk', width: 7, height: 2, ...metadata,7 objects: [8 { id: 'mw', kind: 'word', text: 'MIAU', x: 0, y: 0 },9 { id: 'mi', kind: 'word', text: 'IS', x: 1, y: 0 },10 { id: 'my', kind: 'word', text: 'YOU', x: 2, y: 0 },11 { id: 'fw', kind: 'word', text: 'FLAG', x: 4, y: 0 },12 { id: 'fi', kind: 'word', text: 'IS', x: 5, y: 0 },13 { id: 'fn', kind: 'word', text: 'WIN', x: 6, y: 0 },14 { id: 'player', kind: 'object', noun: 'MIAU', x: 0, y: 1 },15 { id: 'flag', kind: 'object', noun: 'FLAG', x: 3, y: 1 },16 ],17});1819test('world proof check returns structured solved and warning results', () => {20 const result = checkLevel(walkLevel({ allowBypass: true }), { cap: 100 });21 assert.equal(result.ok, true);22 assert.equal(result.checks.result.status, 'SOLVED');23 assert.equal(result.checks.bypass.status, 'SOLVED');24 assert.match(result.warnings.join('; '), /HANDS-OFF/);25});2627test('world proof check gates a disallowed bypass without parsing CLI output', () => {28 const result = checkLevel(walkLevel(), { cap: 100 });29 assert.equal(result.ok, false);30 assert.match(result.issues.join('; '), /BYPASS/);31});3233test('world proof check gates an inconclusive mustForm search', () => {34 const result = checkLevel(walkLevel({ mustForm: ['MIAU IS WIN'] }), { cap: 1 });35 assert.equal(result.ok, false);36 assert.match(result.issues.join('; '), /LIMIT after 1 states/);37 assert.equal(result.checks.mustForm.length, 0);38});