fix: two-player lobby deadlock
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
const assert = require('node:assert/strict');
|
||||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
const test = require('node:test');
|
||||
|
||||
const app = fs.readFileSync(path.join(__dirname, '../../data/app.js'), 'utf8');
|
||||
|
||||
test('Play requests the server-authoritative next player slot', () => {
|
||||
assert.match(app, /join\('player'\)/);
|
||||
assert.doesNotMatch(app, /info\?\.player1Available \? 'player1'/);
|
||||
});
|
||||
|
||||
test('lobby controls are visible only to player1 and enable when player2 is present', () => {
|
||||
assert.match(app, /const playerOne = role === 'player1'/);
|
||||
assert.match(app, /ui\.modeControls\.hidden = !playerOne/);
|
||||
assert.match(app, /state\.players\[1\]\.trim\(\) !== '' \|\| info\?\.player2Available === false/);
|
||||
assert.match(app, /const canStart = playerOne && \(state\.mode === 'bot' \|\| playerTwoReady\)/);
|
||||
});
|
||||
Reference in New Issue
Block a user