mirror of
https://github.com/smogon/pokemon-showdown.git
synced 2026-09-09 17:55:37 -05:00
ESLint has a whole new config format, so I figure it's a good time to make the config system saner. - First, we no longer have separate eslint-no-types configs. Lint performance shouldn't be enough of a problem to justify the relevant maintenance complexity. - Second, our base config should work out-of-the-box now. `npx eslint` will work as expected, without any CLI flags. You should still use `npm run lint` which adds the `--cached` flag for performance. - Third, whatever updates I did fixed style linting, which apparently has been bugged for quite some time, considering all the obvious mixed-tabs-and-spaces issues I found in the upgrade. Also here are some changes to our style rules. In particular: - Curly brackets (for objects etc) now have spaces inside them. Sorry for the huge change. ESLint doesn't support our old style, and most projects use Prettier style, so we might as well match them in this way. See https://github.com/eslint-stylistic/eslint-stylistic/issues/415 - String + number concatenation is no longer allowed. We now consistently use template strings for this.
128 lines
4.5 KiB
JavaScript
128 lines
4.5 KiB
JavaScript
'use strict';
|
|
|
|
const assert = require('../../assert');
|
|
|
|
let team;
|
|
|
|
describe('Team Validator', () => {
|
|
it("should validate Necrozma formes correctly", () => {
|
|
team = [
|
|
{ species: 'necrozmadawnwings', ability: 'prismarmor', shiny: true, moves: ['moongeistbeam', 'metalclaw'], evs: { hp: 1 } },
|
|
];
|
|
assert.legalTeam(team, 'gen7anythinggoes');
|
|
});
|
|
|
|
it('should reject Ultra Necrozma where ambiguous', () => {
|
|
team = [
|
|
{ species: 'necrozmaultra', ability: 'neuroforce', moves: ['confusion'], evs: { hp: 1 } },
|
|
];
|
|
assert.false.legalTeam(team, 'gen7ubers');
|
|
});
|
|
|
|
it('should handle Deoxys formes in Gen 3', () => {
|
|
team = [
|
|
{ species: 'deoxys', ability: 'pressure', moves: ['wrap'], evs: { hp: 1 } },
|
|
{ species: 'deoxys', ability: 'pressure', moves: ['wrap'], evs: { hp: 1 } },
|
|
];
|
|
assert.false.legalTeam(team, 'gen3ubers');
|
|
assert.legalTeam(team, 'gen3ubers@@@!speciesclause');
|
|
|
|
team = [
|
|
{ species: 'deoxysattack', ability: 'pressure', moves: ['wrap'], evs: { hp: 1 } },
|
|
{ species: 'deoxysdefense', ability: 'pressure', moves: ['wrap'], evs: { hp: 1 } },
|
|
];
|
|
assert.false.legalTeam(team, 'gen3ubers@@@!speciesclause');
|
|
assert.legalTeam(team, 'gen3ubers@@@!speciesclause,+nonexistent');
|
|
});
|
|
|
|
it('should correctly validate USUM Rockruff', () => {
|
|
team = [
|
|
{ species: 'rockruff', ability: 'owntempo', moves: ['happyhour'], evs: { hp: 1 } },
|
|
];
|
|
assert.legalTeam(team, 'gen7anythinggoes');
|
|
team = [
|
|
{ species: 'rockruff', level: 9, ability: 'owntempo', moves: ['happyhour'], evs: { hp: 1 } },
|
|
];
|
|
assert.false.legalTeam(team, 'gen7anythinggoes');
|
|
team = [
|
|
{ species: 'rockruff', level: 9, ability: 'owntempo', moves: ['tackle'], evs: { hp: 1 } },
|
|
];
|
|
assert.legalTeam(team, 'gen7anythinggoes');
|
|
team = [
|
|
{ species: 'rockruff', level: 9, ability: 'steadfast', moves: ['happyhour'], evs: { hp: 1 } },
|
|
];
|
|
assert.false.legalTeam(team, 'gen7anythinggoes');
|
|
|
|
team = [
|
|
{ species: 'lycanrocdusk', ability: 'toughclaws', moves: ['happyhour'], evs: { hp: 1 } },
|
|
];
|
|
assert.legalTeam(team, 'gen7anythinggoes');
|
|
team = [
|
|
{ species: 'lycanroc', ability: 'steadfast', moves: ['happyhour'], evs: { hp: 1 } },
|
|
];
|
|
assert.false.legalTeam(team, 'gen7anythinggoes');
|
|
});
|
|
|
|
it('should reject Pokemon that cannot obtain moves in a particular forme', () => {
|
|
team = [
|
|
{ species: 'toxtricity', ability: 'punkrock', moves: ['venomdrench, magneticflux'], evs: { hp: 1 } },
|
|
{ species: 'toxtricity-low-key', ability: 'punkrock', moves: ['venoshock, shiftgear'], evs: { hp: 1 } },
|
|
];
|
|
assert.false.legalTeam(team, 'gen8anythinggoes');
|
|
|
|
team = [
|
|
{ species: 'rotom-wash', ability: 'levitate', moves: ['overheat'], evs: { hp: 1 } },
|
|
];
|
|
assert.false.legalTeam(team, 'gen8anythinggoes');
|
|
|
|
team = [
|
|
{ species: 'kyurem-black', ability: 'teravolt', moves: ['glaciate'], evs: { hp: 1 } },
|
|
];
|
|
assert.false.legalTeam(team, 'gen8anythinggoes');
|
|
|
|
// Scary Face is a TM in Gen 8, so use Gen 7 to test
|
|
team = [
|
|
{ species: 'kyurem-white', ability: 'turboblaze', moves: ['scaryface'], evs: { hp: 1 } },
|
|
];
|
|
assert.false.legalTeam(team, 'gen7anythinggoes');
|
|
|
|
// Hoopa's Hyperspace moves are form-specific in Generation 9
|
|
team = [
|
|
{ species: 'hoopa-confined', ability: 'magician', moves: ['hyperspacefury'], evs: { hp: 1 } },
|
|
{ species: 'hoopa-unbound', ability: 'magician', moves: ['hyperspacehole'], evs: { hp: 1 } },
|
|
];
|
|
assert.false.legalTeam(team, 'gen9anythinggoes');
|
|
|
|
team = [
|
|
{ species: 'hoopa-confined', ability: 'magician', moves: ['hyperspacefury'], evs: { hp: 1 } },
|
|
{ species: 'hoopa-unbound', ability: 'magician', moves: ['hyperspacehole'], evs: { hp: 1 } },
|
|
];
|
|
assert.legalTeam(team, 'gen7anythinggoes');
|
|
});
|
|
|
|
// Zamazenta is unreleased currently
|
|
it.skip('should tier Zacian and Zamazenta formes seperately', () => {
|
|
team = [
|
|
{ species: 'zamazenta-crowned', ability: 'dauntlessshield', item: 'rustedshield', moves: ['howl'], evs: { hp: 1 } },
|
|
];
|
|
assert.legalTeam(team, 'gen9almostanyability');
|
|
|
|
team = [
|
|
{ species: 'zamazenta', ability: 'dauntlessshield', item: 'lifeorb', moves: ['howl'], evs: { hp: 1 } },
|
|
];
|
|
assert.false.legalTeam(team, 'gen9almostanyability');
|
|
});
|
|
|
|
it('should validate Unown formes in Gen 2 based on DVs', () => {
|
|
team = [
|
|
{ species: 'unowng', moves: ['hiddenpower'], ivs: { hp: 12, atk: 20, def: 18, spa: 28, spd: 28, spe: 2 } },
|
|
];
|
|
assert.legalTeam(team, 'gen2ou');
|
|
|
|
team = [
|
|
{ species: 'unown', moves: ['hiddenpower'], ivs: { hp: 0, atk: 4, def: 4, spa: 4, spd: 4, spe: 4 } },
|
|
];
|
|
assert.false.legalTeam(team, 'gen2ou');
|
|
});
|
|
});
|