Skip to content

Commit 0fcbb81

Browse files
committed
Add tests
1 parent 010223e commit 0fcbb81

File tree

1 file changed

+73
-0
lines changed

1 file changed

+73
-0
lines changed

test/ev-optimizer.test.js

+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
const assert = require('assert').strict;
2+
3+
try {
4+
global.BattlePokedex = require('../play.pokemonshowdown.com/data/pokedex.js').BattlePokedex;
5+
} catch (err) {}
6+
require('../play.pokemonshowdown.com/js/battle-dex-data.js');
7+
require('../play.pokemonshowdown.com/js/battle-dex.js');
8+
require('../play.pokemonshowdown.com/js/battle-tooltips.js');
9+
10+
describe('EV Optimizer', () => {
11+
(global.BattlePokedex ? it : it.skip)('should find the spreads that saves the most EVs', () => {
12+
const trapinch = BattleStatOptimizer({
13+
species: "Trapinch",
14+
nature: "Lax",
15+
evs: {hp: 204, atk: 252, def: 52, spa: 0, spd: 0, spe: 0},
16+
level: 100
17+
}, 'gen9');
18+
assert.deepStrictEqual(trapinch, {
19+
evs: {hp: 204, atk: 144, def: 104, spa: 0, spd: 0, spe: 0},
20+
plus: 'atk',
21+
minus: 'spd',
22+
savedEVs: 56,
23+
});
24+
25+
const groudon = BattleStatOptimizer({
26+
species: "Groudon-Primal",
27+
nature: "Serious",
28+
evs: {hp: 0, atk: 252, def: 0, spa: 156, spd: 0, spe: 100},
29+
level: 100
30+
}, 'gen7');
31+
assert.deepStrictEqual(groudon, {
32+
evs: {hp: 0, atk: 88, def: 0, spa: 156, spd: 96, spe: 100},
33+
plus: 'atk',
34+
minus: 'spd',
35+
savedEVs: 68,
36+
});
37+
38+
const thundurus = BattleStatOptimizer({
39+
species: "Thundurus",
40+
nature: "Timid",
41+
evs: {hp: 252, atk: 0, def: 0, spa: 232, spd: 0, spe: 24},
42+
ivs: {hp: 31, atk: 2, def: 31, spa: 30, spd: 31, spe: 30},
43+
level: 50
44+
}, 'gen5');
45+
assert.deepStrictEqual(thundurus, {
46+
evs: {hp: 252, atk: 0, def: 0, spa: 112, spd: 0, spe: 128},
47+
plus: 'spa',
48+
minus: 'atk',
49+
savedEVs: 16,
50+
});
51+
52+
const amoonguss = BattleStatOptimizer({
53+
species: "Amoonguss",
54+
nature: "Bold",
55+
evs: {hp: 252, atk: 0, def: 100, spa: 0, spd: 156, spe: 0},
56+
level: 50
57+
}, 'gen9');
58+
assert.deepStrictEqual(amoonguss, {
59+
evs: {hp: 252, atk: 0, def: 180, spa: 0, spd: 76, spe: 0},
60+
plus: 'spd',
61+
minus: 'atk',
62+
savedEVs: 0,
63+
});
64+
65+
const mienfoo = BattleStatOptimizer({
66+
species: "Mienfoo",
67+
nature: "Jolly",
68+
evs: {hp: 0, atk: 236, def: 116, spa: 0, spd: 0, spe: 156},
69+
level: 5
70+
}, 'gen9');
71+
assert.equal(mienfoo, null);
72+
});
73+
});

0 commit comments

Comments
 (0)