Add multiplayer transport regression coverage

This commit is contained in:
Admin 2026-09-21 01:38:20 +00:00
parent 74ecc68b17
commit 29f47aff71

View File

@ -263,6 +263,31 @@ test('environment physics adds wind, soft island collision, turbulence, and proj
assert.match(source, /windSpeed: this\.environmentWind\?\.strength/); 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 () => { test('mobile controls enter a dock hub before shipyard, trade, or missions', async () => {
const [game, hud, index, entry, dockUi] = await Promise.all([ const [game, hud, index, entry, dockUi] = await Promise.all([
read('src/game-v4.js'), read('src/game-v4.js'),