mirror of
https://github.com/smogon/pokemon-showdown.git
synced 2026-05-11 06:54:10 -05:00
It turns out that when I switched us from `assert` to `assert.strict`,
I didn't actually update any existing tests or tell anyone:
0df0d234f2
So apparently everyone else just kept on using `strictEqual`.
This will be a PR and also throw an error if people continue trying to
use it, which should make it much clearer what PS policy is on this.
A lot of the problem may be that TypeScript marks assert.strict.equal
as deprecated when it's not. This was fixed 4 days ago:
https://github.com/DefinitelyTyped/DefinitelyTyped/pull/48452
But this probably hasn't made it to a thing yet. Until then, you'll
have to deal with TS marking your tests as deprecated, but it shouldn't
be too long.
Accidentally using `assert` instead of `assert.strict` should now show
an error. This protects against the probably much worse mistake of
accidentally using `assert.equal` rather than `assert.strict.equal`.
`assert.ok` is also deprecated now.
63 lines
2.7 KiB
JavaScript
63 lines
2.7 KiB
JavaScript
'use strict';
|
|
|
|
const assert = require('./../../assert');
|
|
const common = require('./../../common');
|
|
|
|
let battle;
|
|
|
|
describe('Magic Bounce', function () {
|
|
afterEach(function () {
|
|
battle.destroy();
|
|
});
|
|
|
|
it('should bounce Growl', function () {
|
|
// Sanity check: if this test fails, the remaining tests for Magic Bounce may not make sense.
|
|
// Tests for specific moves belong to the respective moves' test suites.
|
|
battle = common.createBattle();
|
|
battle.setPlayer('p1', {team: [{species: "Bulbasaur", ability: 'overgrow', moves: ['growl']}]});
|
|
battle.setPlayer('p2', {team: [{species: "Espeon", ability: 'magicbounce', moves: ['futuresight']}]});
|
|
battle.makeChoices('move growl', 'move futuresight');
|
|
assert.statStage(battle.p1.active[0], 'atk', -1);
|
|
assert.statStage(battle.p2.active[0], 'atk', 0);
|
|
});
|
|
|
|
it('should bounce once when target and source share the ability', function () {
|
|
battle = common.createBattle();
|
|
battle.setPlayer('p1', {team: [{species: "Xatu", ability: 'magicbounce', moves: ['roost']}]});
|
|
battle.setPlayer('p2', {team: [{species: "Espeon", ability: 'magicbounce', moves: ['growl']}]});
|
|
assert.doesNotThrow(() => battle.makeChoices('move roost', 'move growl'));
|
|
assert.statStage(battle.p1.active[0], 'atk', 0);
|
|
assert.statStage(battle.p2.active[0], 'atk', -1);
|
|
});
|
|
|
|
it('should not cause a choice-lock', function () {
|
|
battle = common.createBattle();
|
|
battle.setPlayer('p1', {team: [
|
|
{species: "Spoink", ability: 'thickfat', moves: ['bounce']},
|
|
{species: "Xatu", item: 'choicescarf', ability: 'magicbounce', moves: ['roost', 'growl']},
|
|
]});
|
|
battle.setPlayer('p2', {team: [{species: "Espeon", ability: 'magicbounce', moves: ['growl', 'recover']}]});
|
|
battle.makeChoices('switch 2', 'move growl');
|
|
battle.makeChoices('move roost', 'move recover');
|
|
assert.notEqual(battle.p1.active[0].lastMove.id, 'growl');
|
|
});
|
|
|
|
it('should be suppressed by Mold Breaker', function () {
|
|
battle = common.createBattle();
|
|
battle.setPlayer('p1', {team: [{species: "Bulbasaur", ability: 'moldbreaker', moves: ['growl']}]});
|
|
battle.setPlayer('p2', {team: [{species: "Espeon", ability: 'magicbounce', moves: ['futuresight']}]});
|
|
battle.makeChoices('move growl', 'move futuresight');
|
|
assert.statStage(battle.p1.active[0], 'atk', 0);
|
|
assert.statStage(battle.p2.active[0], 'atk', -1);
|
|
});
|
|
|
|
it('should not bounce moves while semi-invulnerable', function () {
|
|
battle = common.createBattle();
|
|
battle.setPlayer('p1', {team: [{species: "Bulbasaur", ability: 'overgrow', moves: ['growl']}]});
|
|
battle.setPlayer('p2', {team: [{species: "Xatu", ability: 'magicbounce', moves: ['fly']}]});
|
|
battle.makeChoices('move growl', 'move fly');
|
|
assert.statStage(battle.p1.active[0], 'atk', 0);
|
|
assert.statStage(battle.p2.active[0], 'atk', 0);
|
|
});
|
|
});
|