Connect ordinary Semuta in Advanced Richese preview
Verify and publish checkpoint container / container (push) Canceled after 0s
Verify and publish checkpoint container / container (push) Canceled after 0s
This commit is contained in:
1 parent
3c1cbd071e
commit
b93c5c4cf5
7 files changed
+287
-2
No files matched your search
@@ -0,0 +1,41 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
import { registerHooks } from 'node:module';
|
||||
import { readFileSync } from 'node:fs';
|
||||
import { createElement } from 'react';
|
||||
import { renderToStaticMarkup } from 'react-dom/server';
|
||||
import { applyAction, createGame, joinGame, newPlayer, viewGame } from '../game/engine';
|
||||
|
||||
const aliases = registerHooks({
|
||||
resolve(specifier, context, next) {
|
||||
return next(specifier === 'next/image' ? 'vinext/shims/image' :
|
||||
specifier === 'next/link' ? 'vinext/shims/link' : specifier, context);
|
||||
},
|
||||
load(url, context, next) {
|
||||
if (!url.endsWith('.module.css')) return next(url, context);
|
||||
const css = readFileSync(new URL(url), 'utf8');
|
||||
const classes = Object.fromEntries([...css.matchAll(/\.([a-zA-Z_][\w-]*)/g)].map(match => [match[1], match[1]]));
|
||||
return {format:'module', source:`export default ${JSON.stringify(classes)}`, shortCircuit:true};
|
||||
},
|
||||
});
|
||||
const { GameTable } = await import('../components/game-table');
|
||||
aliases.deregister();
|
||||
|
||||
void test('public Advanced Richese setup displays the limited ordinary Semuta notice', () => {
|
||||
let game = createGame('ADVSEMUTAUI', newPlayer('a', 'Atreides', 'atreides'), true, ['choam']);
|
||||
joinGame(game, newPlayer('r', 'Richese', 'richese'));
|
||||
joinGame(game, newPlayer('e', 'Emperor', 'emperor'));
|
||||
for (const player of game.players) game = applyAction(game, player.id, {type:'ready'});
|
||||
game = applyAction(game, 'a', {type:'start', advancedPreview:true});
|
||||
assert.equal(game.status, 'setup');
|
||||
const view = viewGame(game, 'r');
|
||||
assert.equal(view.semutaAdvancedOrdinaryPreview, true);
|
||||
assert.equal(view.semutaPreview, false);
|
||||
const html = renderToStaticMarkup(createElement(GameTable, {
|
||||
game:view, busy:false, send:async () => {}, onExit() {},
|
||||
}));
|
||||
assert.match(html, /Advanced Semuta preview: supported ordinary Hajr, Ghola, Harvester and Weather Control discards can be claimed/);
|
||||
assert.match(html, /Other discard opportunities remain unfinished/);
|
||||
assert.doesNotMatch(html, /Semuta Drug development preview/);
|
||||
assert.doesNotMatch(html, /Semuta Drug with Homeworlds development preview/);
|
||||
});
|
||||
Reference in new issue
Block a user