Interpret compound Truthtrance hand facts
Verify and publish checkpoint container / container (push) Successful in 10m54s

This commit is contained in:
Quintine committed 2026-10-29 17:56:30 +11:00
1 parent 4224bb3e2a
commit 15a4f3038a
9 files changed
+268 -17

No files matched your search

+41 -1
View File
@@ -2,7 +2,7 @@ import assert from 'node:assert/strict';
import test from 'node:test';
import { createElement } from 'react';
import { renderToStaticMarkup } from 'react-dom/server';
import { Truthtrance } from '../components/truthtrance';
import { FreeformFactPreview, Truthtrance } from '../components/truthtrance';
import { applyAction, viewGame, type Game } from '../game/engine';
import { knowledgeGame } from './truthtrance-knowledge-fixture';
@@ -79,3 +79,43 @@ void test('a negative freeform displays the checked zero-card meaning without ex
assert.match(target, /Your current game information establishes:/);
assert.doesNotMatch(observer, /Your current game information establishes:/);
});
void test('a category and negative-card compound displays its checked aggregate without revealing the answer', () => {
const game = pending(5, 'Do you have a weapon and no Shield?');
const target = markup(game, 'b'), observer = markup(game, 'o');
for (const html of [target, observer]) {
assert.match(html, /Checked as:/);
assert.match(html, /you currently hold at least 1 card whose primary role is a weapon/);
assert.match(html, /AND/);
assert.match(html, /you currently hold exactly 0 cards named Shield/);
}
assert.match(target, /Your current game information establishes:/);
assert.doesNotMatch(observer, /Your current game information establishes:/);
});
void test('unsupported mixed conjunctions keep their manual answer control', () => {
const game = pending(5, 'Do you have a weapon and a defense or a Shield?');
const target = markup(game, 'b');
assert.doesNotMatch(target, /Checked as:/);
assert.doesNotMatch(target, /Your current game information establishes:/);
assert.match(target, /Answer Yes/);
assert.match(target, /Answer No/);
});
void test('the question editor previews the v5 interpretation only for current facts', () => {
const props = { scope: 'fact' as const, text: 'Do you have a weapon and no Shield?', target: 'b',
leaderName: (id: string) => id, locationName: (id: string) => id, playerName: (id: string) => id };
const recognized = renderToStaticMarkup(createElement(FreeformFactPreview, props));
assert.match(recognized, /Recognized freeform question/);
assert.match(recognized, /primary role is a weapon/);
assert.match(recognized, /AND/);
assert.match(recognized, /exactly 0 cards named Shield/);
for (const other of [
{ ...props, scope: 'currentTurn' as const },
{ ...props, text: 'Do you have a weapon and a defense or a Shield?' },
]) {
const manual = renderToStaticMarkup(createElement(FreeformFactPreview, other));
assert.match(manual, /not automatically interpreted/);
assert.doesNotMatch(manual, /Recognized freeform question/);
}
});