mirror of
https://github.com/smogon/pokemon-showdown.git
synced 2026-05-18 11:14:39 -05:00
BattleRoom is now GameRoom, a slightly more abstract room type capable of holding any of a number of possible roomgames. Currently, battles are the only such roomgame, but any future roomgame could possibly use it. Differences between ChatRoom and GameRoom: - GameRooms start at the left, ChatRooms start at the right - GameRooms have chat on the right, and a game area on the left, with a view area at the top left and a controls area at the bottom left - GameRooms retain all their logs, ChatRooms only retain the latest 100 lines - GameRooms expire after 40 minutes of inactivity or 10 minutes of zero online users (configurable in the future) - GameRooms are guaranteed to have an associated game, while ChatRooms may or may not
40 lines
1.2 KiB
JavaScript
40 lines
1.2 KiB
JavaScript
'use strict';
|
|
|
|
const assert = require('assert');
|
|
|
|
const {User} = require('./../../dev-tools/users-utils');
|
|
|
|
describe('Simulator abstraction layer features', function () {
|
|
describe('Battle', function () {
|
|
describe('player identifiers', function () {
|
|
let p1, p2, room;
|
|
afterEach(function () {
|
|
if (p1) {
|
|
p1.disconnectAll();
|
|
p1.destroy();
|
|
}
|
|
if (p2) {
|
|
p2.disconnectAll();
|
|
p2.destroy();
|
|
}
|
|
if (room) room.destroy();
|
|
});
|
|
|
|
it('should not get players out of sync in rated battles on rename', function () {
|
|
// Regression test for 47263c8749
|
|
let packedTeam = 'Weavile||lifeorb||swordsdance,knockoff,iceshard,iciclecrash|Jolly|,252,,,4,252|||||';
|
|
p1 = new User();
|
|
p2 = new User();
|
|
p1.forceRename("Missingno."); // Don't do this at home
|
|
room = Rooms.createBattle('', {p1, p2, p1team: packedTeam, p2team: packedTeam, rated: true});
|
|
p1.resetName();
|
|
for (const [i, playerName] of room.battle.playerNames.entries()) {
|
|
const player = room.battle['p' + (i + 1)];
|
|
assert.strictEqual(player.name, playerName);
|
|
assert.strictEqual(player, room.battle.players[toId(playerName)]);
|
|
}
|
|
});
|
|
});
|
|
});
|
|
});
|