diff --git a/tests/wiring.test.mjs b/tests/wiring.test.mjs index 00389e6..cfb1170 100644 --- a/tests/wiring.test.mjs +++ b/tests/wiring.test.mjs @@ -263,6 +263,31 @@ test('environment physics adds wind, soft island collision, turbulence, and proj assert.match(source, /windSpeed: this\.environmentWind\?\.strength/); }); +test('multiplayer transport uses Keycloak tickets and renders remote Sparrows without physics authority', async () => { + const [game, entry, multiplayer, pkg, server] = await Promise.all([ + read('src/game-v4.js'), + read('src/game-entry.js'), + read('src/multiplayer.js'), + read('package.json'), + read('server/main.go'), + ]); + + assert.match(entry, /import '.\/multiplayer\.js'/); + assert.match(pkg, /"keycloak-js"/); + assert.match(multiplayer, /clientId: 'airship-web'/); + assert.match(multiplayer, /\/api\/ws-ticket/); + assert.match(multiplayer, /Authorization:/); + assert.match(multiplayer, /new WebSocket/); + assert.match(game, /airship:multiplayer-snapshot/); + assert.match(game, /this\.remotePlayers = new Map\(\)/); + assert.match(game, /window\.airshipMultiplayer\?\.sendState/); + assert.match(game, /this\.add\.sprite\([\s\S]*?'player-airship'/); + assert.match(server, /CREATE TABLE IF NOT EXISTS player_profiles/); + assert.match(server, /a\.tickets\.consume/); + assert.match(server, /clampFloat\(msg\.X, 0, 3600\)/); + assert.match(server, /time\.NewTicker\(100 \* time\.Millisecond\)/); +}); + test('mobile controls enter a dock hub before shipyard, trade, or missions', async () => { const [game, hud, index, entry, dockUi] = await Promise.all([ read('src/game-v4.js'),