18 lines
1.0 KiB
TypeScript
18 lines
1.0 KiB
TypeScript
import test from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
import { createElement } from 'react';
|
|
import { renderToStaticMarkup } from 'react-dom/server';
|
|
import { CardCountFields } from '../components/truthtrance-card-count';
|
|
import type { HandInventoryFact } from '../game/truthtrance-hand-inventory';
|
|
|
|
void test('inventory controls offer precise printed primary attack and defense types', () => {
|
|
const value: HandInventoryFact = { kind: 'handInventory', category: 'poisonWeapon', compare: 'gte', value: 1 };
|
|
const html = renderToStaticMarkup(createElement(CardCountFields, { value, onChange() {} }));
|
|
for (const category of ['projectileWeapon', 'poisonWeapon', 'projectileDefense', 'poisonDefense'])
|
|
assert.match(html, new RegExp(`value="${category}"`));
|
|
assert.match(html, /Poison Blade and Shield Snooper match both/);
|
|
assert.match(html, /Mirror Weapon has no fixed poison or/);
|
|
assert.match(html, /Alternate uses and faction powers do not change/);
|
|
assert.match(html, /Number of cards/);
|
|
});
|