Files
Dune/tests/emperor-auction-gift-cache-controls.test.tsx
Quintine dac1b432db
Verify and publish checkpoint container / container (push) Canceled after 0s
Extend Basic Emperor auction gifts to Nexus and Richese
2026-10-30 19:06:22 +11:00

33 lines
1.7 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import assert from 'node:assert/strict';
import test from 'node:test';
import { createElement } from 'react';
import { renderToStaticMarkup } from 'react-dom/server';
import type { GameView } from '../game/engine';
import { EmperorAuctionGift } from '../components/emperor-auction-gift';
/** Synthetic owner projection: this verifies the rendered distinction, not
* a claim that a real cache-sale journey has already reached this control. */
const view = (source?: 'richese') => ({
players: [{id:'ally', name:'Ally'}],
emperorAuctionGift: {event:'gift-event', recipient:'ally', maximum:5, ...(source ? {source} : {})},
}) as unknown as GameView;
const render = (game: GameView, busy = false) => renderToStaticMarkup(
createElement(EmperorAuctionGift, {game, busy, act() {}}),
);
void test('Richese sale describes the committed payment and retains gift and Continue controls', () => {
const html = render(view('richese'));
assert.match(html, /Share spice with Ally/);
assert.match(html, /Continue settles the Richese sale with that payment after any gift response/);
assert.doesNotMatch(html, /Your ally chooses how to pay/);
assert.match(html, /<button\b(?![^>]*disabled)[^>]*>Share spice<\/button>/);
assert.match(html, /<button\b(?![^>]*disabled)[^>]*>Continue to payment<\/button>/);
assert.match(render(view('richese'), true), /<button\b[^>]*disabled=""[^>]*>Continue to payment<\/button>/);
});
void test('ordinary auction keeps its original buyer-payment guidance', () => {
const html = render(view());
assert.match(html, /Your ally chooses how to pay after the gift’s Karama response/);
assert.doesNotMatch(html, /Continue settles the Richese sale/);
});