mirror of
https://github.com/smogon/pokemon-showdown.git
synced 2026-05-19 05:31:16 -05:00
If Custom Game was configured as never rated (in order to e.g. give it an unrated ladder), it would yield bogus failures.
46 lines
1.4 KiB
JavaScript
46 lines
1.4 KiB
JavaScript
'use strict';
|
|
|
|
const assert = require('assert');
|
|
let userUtils = require('./../../dev-tools/users-utils.js');
|
|
let User = userUtils.User;
|
|
|
|
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.expire();
|
|
});
|
|
|
|
it('should not get players out of sync in rated battles on rename', function () {
|
|
// Regression test for 47263c8749
|
|
// Since updated to new API used by room battles.
|
|
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.global.startBattle(p1, p2, '', packedTeam, packedTeam, {rated: true});
|
|
if (!room.active) {
|
|
room.joinBattle(p1, packedTeam);
|
|
room.joinBattle(p2, packedTeam);
|
|
}
|
|
p1.resetName();
|
|
for (let i = 0; i < room.battle.playerNames.length; i++) {
|
|
let playerName = room.battle.playerNames[i];
|
|
let playerData = room.battle['p' + (i + 1)];
|
|
assert.strictEqual(playerData.name, playerName);
|
|
assert.strictEqual(playerData, room.battle.players[toId(playerName)]);
|
|
}
|
|
});
|
|
});
|
|
});
|
|
});
|