mirror of
https://github.com/smogon/pokemon-showdown.git
synced 2026-04-22 18:47:39 -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.
115 lines
5.8 KiB
JavaScript
115 lines
5.8 KiB
JavaScript
'use strict';
|
|
|
|
const assert = require('./../../assert');
|
|
const common = require('./../../common');
|
|
|
|
let battle;
|
|
|
|
describe('Delta Stream', function () {
|
|
afterEach(function () {
|
|
battle.destroy();
|
|
});
|
|
|
|
it('should activate the Delta Stream weather upon switch-in', function () {
|
|
battle = common.createBattle();
|
|
battle.setPlayer('p1', {team: [{species: "Rayquaza", ability: 'deltastream', moves: ['roost']}]});
|
|
battle.setPlayer('p2', {team: [{species: "Abra", ability: 'magicguard', moves: ['teleport']}]});
|
|
assert(battle.field.isWeather('deltastream'));
|
|
});
|
|
|
|
it('should negate the type weaknesses of the Flying-type', function () {
|
|
battle = common.createBattle();
|
|
battle.setPlayer('p1', {team: [{species: "Tornadus", ability: 'deltastream', item: 'weaknesspolicy', moves: ['recover']}]});
|
|
battle.setPlayer('p2', {team: [{species: "Smeargle", ability: 'owntempo', moves: ['thundershock', 'powdersnow', 'powergem']}]});
|
|
const pokemon = battle.p1.active[0];
|
|
for (let i = 1; i <= 3; i++) {
|
|
battle.makeChoices('move recover', 'move ' + i);
|
|
assert.statStage(pokemon, 'atk', 0);
|
|
assert.statStage(pokemon, 'spa', 0);
|
|
assert.holdsItem(pokemon);
|
|
}
|
|
});
|
|
|
|
it('should not negate the type weaknesses of any other type, even if the Pokemon is Flying-type', function () {
|
|
battle = common.createBattle();
|
|
battle.setPlayer('p1', {team: [{species: "Rayquaza", ability: 'deltastream', item: 'weaknesspolicy', moves: ['recover']}]});
|
|
battle.setPlayer('p2', {team: [{species: "Smeargle", ability: 'owntempo', moves: ['dragonpulse']}]});
|
|
battle.makeChoices('move recover', 'move dragonpulse');
|
|
const pokemon = battle.p1.active[0];
|
|
assert.statStage(pokemon, 'atk', 2);
|
|
assert.statStage(pokemon, 'spa', 2);
|
|
assert.false.holdsItem(pokemon);
|
|
});
|
|
|
|
it('should not reduce damage from Stealth Rock', function () {
|
|
battle = common.createBattle();
|
|
battle.setPlayer('p1', {team: [
|
|
{species: "Rayquaza", ability: 'pressure', moves: ['roost']},
|
|
{species: "Ho-Oh", ability: 'pressure', moves: ['roost']},
|
|
]});
|
|
battle.setPlayer('p2', {team: [{species: "Lugia", ability: 'deltastream', moves: ['stealthrock']}]});
|
|
battle.makeChoices('move roost', 'move stealthrock');
|
|
const pokemon = battle.p1.pokemon[1];
|
|
assert.hurtsBy(pokemon, Math.floor(pokemon.maxhp / 2), () => battle.makeChoices('switch 2', 'move stealthrock'));
|
|
});
|
|
|
|
it('should prevent moves and abilities from setting the weather to Sunny Day, Rain Dance, Sandstorm, or Hail', function () {
|
|
battle = common.createBattle();
|
|
battle.setPlayer('p1', {team: [{species: "Rayquaza", ability: 'deltastream', moves: ['helpinghand']}]});
|
|
battle.setPlayer('p2', {team: [
|
|
{species: "Abra", ability: 'magicguard', moves: ['teleport']},
|
|
{species: "Kyogre", ability: 'drizzle', moves: ['raindance']},
|
|
{species: "Groudon", ability: 'drought', moves: ['sunnyday']},
|
|
{species: "Tyranitar", ability: 'sandstream', moves: ['sandstorm']},
|
|
{species: "Abomasnow", ability: 'snowwarning', moves: ['hail']},
|
|
]});
|
|
for (let i = 2; i <= 5; i++) {
|
|
battle.makeChoices('move helpinghand', 'switch ' + i);
|
|
assert(battle.field.isWeather('deltastream'));
|
|
battle.makeChoices('move helpinghand', 'move 1');
|
|
assert(battle.field.isWeather('deltastream'));
|
|
}
|
|
});
|
|
|
|
it('should cause the Delta Stream weather to fade if it switches out and no other Delta Stream Pokemon are active', function () {
|
|
battle = common.createBattle();
|
|
battle.setPlayer('p1', {team: [
|
|
{species: "Rayquaza", ability: 'deltastream', moves: ['helpinghand']},
|
|
{species: "Ho-Oh", ability: 'pressure', moves: ['roost']},
|
|
]});
|
|
battle.setPlayer('p2', {team: [{species: "Lugia", ability: 'pressure', moves: ['roost']}]});
|
|
assert.sets(() => battle.field.isWeather('deltastream'), false, () => battle.makeChoices('switch 2', 'move roost'));
|
|
});
|
|
|
|
it('should not cause the Delta Stream weather to fade if it switches out and another Delta Stream Pokemon is active', function () {
|
|
battle = common.createBattle();
|
|
battle.setPlayer('p1', {team: [
|
|
{species: "Rayquaza", ability: 'deltastream', moves: ['helpinghand']},
|
|
{species: "Ho-Oh", ability: 'pressure', moves: ['roost']},
|
|
]});
|
|
battle.setPlayer('p2', {team: [{species: "Rayquaza", ability: 'deltastream', moves: ['bulkup']}]});
|
|
assert.constant(() => battle.field.isWeather('deltastream'), () => battle.makeChoices('switch 2', 'move bulkup'));
|
|
});
|
|
|
|
it('should cause the Delta Stream weather to fade if its ability is suppressed and no other Delta Stream Pokemon are active', function () {
|
|
battle = common.createBattle();
|
|
battle.setPlayer('p1', {team: [{species: "Rayquaza", ability: 'deltastream', moves: ['helpinghand']}]});
|
|
battle.setPlayer('p2', {team: [{species: "Lugia", ability: 'pressure', moves: ['gastroacid']}]});
|
|
assert.sets(() => battle.field.isWeather('deltastream'), false, () => battle.makeChoices('move helpinghand', 'move gastroacid'));
|
|
});
|
|
|
|
it('should not cause the Delta Stream weather to fade if its ability is suppressed and another Delta Stream Pokemon is active', function () {
|
|
battle = common.createBattle();
|
|
battle.setPlayer('p1', {team: [{species: "Rayquaza", ability: 'deltastream', moves: ['helpinghand']}]});
|
|
battle.setPlayer('p2', {team: [{species: "Rayquaza", ability: 'deltastream', moves: ['gastroacid']}]});
|
|
assert.constant(() => battle.field.isWeather('deltastream'), () => battle.makeChoices('move helpinghand', 'move gastroacid'));
|
|
});
|
|
|
|
it('should cause the Delta Stream weather to fade if its ability is changed and no other Delta Stream Pokemon are active', function () {
|
|
battle = common.createBattle();
|
|
battle.setPlayer('p1', {team: [{species: "Rayquaza", ability: 'deltastream', moves: ['helpinghand']}]});
|
|
battle.setPlayer('p2', {team: [{species: "Lugia", ability: 'pressure', moves: ['entrainment']}]});
|
|
assert.sets(() => battle.field.isWeather('deltastream'), false, () => battle.makeChoices('move helpinghand', 'move entrainment'));
|
|
});
|
|
});
|