pokemon-showdown/test/sim/dex.js
Guangcong Luo f6f4467265 Turn on prefer-const for .js files
Not having prefer-const on the JS side makes JS -> TS refactors really
unreadable. This commit just auto-fixes it so we're using
`prefer-const` everywhere.
2020-04-23 11:37:47 -07:00

63 lines
2.2 KiB
JavaScript

'use strict';
const assert = require('./../assert');
describe('Mod loader', function () {
it.skip('should work fine in any order', function () {
{
Chat.uncacheTree('./.sim-dist/dex');
const Dex = require('./../../../.sim-dist/dex').Dex;
assert.equal(Dex.mod('gen2').getSpecies('nidoking').learnset.bubblebeam.join(','), '1M');
assert.equal(Dex.mod('gen2').getMove('crunch').secondaries[0].boosts.def, undefined);
}
{
Chat.uncacheTree('./.sim-dist/dex');
const Dex = require('./../../../.sim-dist/dex').Dex;
Dex.mod('gen2').getSpecies('nidoking');
Dex.mod('gen4').getMove('crunch');
assert.equal(Dex.mod('gen2').getSpecies('nidoking').learnset.bubblebeam.join(','), '1M');
assert.equal(Dex.mod('gen2').getMove('crunch').secondaries[0].boosts.def, undefined);
}
});
});
describe('Dex#getEffect', function () {
it('returns the same object for the same id', function () {
assert.equal(Dex.getEffect('Stealth Rock'), Dex.getEffect('stealthrock'));
assert.notStrictEqual(Dex.getEffect('move: Stealth Rock'), Dex.getEffect('stealthrock'));
});
it('does not return elements from the Object prototype', function () {
assert.false(Dex.getEffect('constructor').exists);
});
});
describe('Dex#getForme', function () {
it('should handle Flabébé formes', function () {
assert.equal(Dex.getForme('Flabébé-yellow'), 'Flabébé-Yellow');
});
});
describe('Dex#getSpecies', function () {
it('should handle Minior-Meteor formes', function () {
assert(Dex.getSpecies('Minior-Meteor').isNonstandard);
assert(!Dex.forGen(7).getSpecies('Minior-Meteor').isNonstandard);
});
it.skip('should handle Rockruff-Dusk', function () {
assert.equal(Dex.getSpecies('Rockruff-Dusk').name, 'Rockruff-Dusk');
});
});
describe('Dex#getItem', function () {
it('should not mark Gems as as Nonstandard in Gens 5-7', function () {
assert(!Dex.forGen(5).getItem('Rock Gem').isNonstandard);
assert(!Dex.forGen(5).getItem('Normal Gem').isNonstandard);
assert(Dex.forGen(6).getItem('Rock Gem').isNonstandard === 'Unobtainable');
assert(!Dex.forGen(6).getItem('Normal Gem').isNonstandard);
assert(Dex.forGen(8).getItem('Rock Gem').isNonstandard === 'Past');
});
});