mirror of
https://github.com/Such-Software/wownerogue.git
synced 2026-10-17 14:21:25 +02:00
A browser-based roguelike synchronized with crypto block timing. A run is a race against the next block: reach the exit before the block lands, or the house wins. The same codebase runs the solo dungeon, the social Tavern, and operator-selected PvP and race rulesets, with separate free and paid leaderboards. Self-hostable under the MIT License. See README.md to run it, docs/ARCHITECTURE.md for the design, and docs/DEPLOY.md to operate an instance.
29 lines
1.1 KiB
JavaScript
29 lines
1.1 KiB
JavaScript
const MatchRoom = require('../src/multiplayer/MatchRoom');
|
|
|
|
describe('MatchRoom reconnect safety', () => {
|
|
test('disconnect grace does not remove player state', () => {
|
|
const room = new MatchRoom({
|
|
entrants: { a: { userId: 1 }, b: { userId: 2 } },
|
|
seed: '0000000000000000000000000000000000000000000000000000000000000000'
|
|
});
|
|
room.start();
|
|
expect(room.playerStates.get('a').alive).toBe(true);
|
|
// Simulate a forfeit / AFK kill.
|
|
room._killPlayer('a', 'afk');
|
|
expect(room.playerStates.get('a').alive).toBe(false);
|
|
expect(room.activePlayerCount).toBe(1);
|
|
});
|
|
|
|
test('all players dying ends match', () => {
|
|
const room = new MatchRoom({
|
|
entrants: { a: { userId: 1 }, b: { userId: 2 } },
|
|
seed: '0000000000000000000000000000000000000000000000000000000000000000'
|
|
});
|
|
room.start();
|
|
room._killPlayer('a', 'monster');
|
|
room._killPlayer('b', 'monster');
|
|
expect(room.status).toBe('finished');
|
|
expect(room.endReason).toBe('all_dead');
|
|
});
|
|
});
|