Connect classic allied Bureaucrat payment redirection

This commit is contained in:
Quintine committed 2026-10-13 08:24:56 +11:00
1 parent ec574ab0f5
commit c3d1896673
17 files changed
+1057 -220

No files matched your search

@@ -1,19 +1,10 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import { registerHooks } from 'node:module';
import { createElement } from 'react';
import { renderToStaticMarkup } from 'react-dom/server';
import { BureaucratPayment } from '../components/bureaucrat-payment';
import type { GameView } from '../game/engine';
const aliases = registerHooks({
resolve(specifier, context, next) {
return next(
specifier === 'next/image' ? 'vinext/shims/image' : specifier,
context,
);
},
});
function view(overrides: Record<string, unknown> = {}) {
return {
@@ -50,15 +41,6 @@ function markup(game: GameView, busy = false) {
);
}
void test('owned matching Bureaucrat decision shows both payment costs and public names', () => {
const html = markup(view({ me: 'owner' }));
assert.match(html, /payment from House Payer to House Payee is 5 spice/);
assert.match(html, /House Payee receives 3 spice/);
assert.match(html, /Bank receives 2/);
assert.match(html, /still pays the full amount/);
assert.match(html, /Redirect 2 spice to the Bank/);
assert.match(html, /Allow full 5-spice payment/);
});
void test('non-owner and stale decisions render no Bureaucrat controls', () => {
assert.equal(markup(view()), '');
@@ -73,13 +55,3 @@ void test('busy Bureaucrat controls are disabled', () => {
assert.ok((html.match(/disabled=""/g) ?? []).length >= 2);
});
void test('bribe redirection keeps the remaining payment unavailable until Mentat', () => {
const game = view({ me: 'owner' });
game.bureaucrat.pending!.kind = 'bribe';
const html = markup(game);
assert.match(html, /recipient keeps this spice in front of their shield until the next Mentat Pause/);
assert.match(html, /cannot be spent before then/);
assert.match(html, /House Payee receives 3 spice/);
});
aliases.deregister();