pokemon-showdown/test/sim/items/focussash.js
Guangcong Luo 229f5f809d Use assert in strict mode
This makes it so we can use `assert.equal` instead of
`assert.strictEqual`, which I think is more readable.
2020-02-20 00:39:31 -08:00

55 lines
2.2 KiB
JavaScript

'use strict';
const assert = require('./../../assert');
const common = require('./../../common');
let battle;
describe('Focus Sash', function () {
afterEach(function () {
battle.destroy();
});
it('should be consumed and allow its user to survive an attack from full HP', function () {
battle = common.createBattle();
battle.setPlayer('p1', {team: [{species: 'Paras', ability: 'dryskin', item: 'focussash', moves: ['sleeptalk']}]});
battle.setPlayer('p2', {team: [{species: 'Delphox', ability: 'magician', moves: ['incinerate']}]});
const holder = battle.p1.active[0];
battle.makeChoices('move sleeptalk', 'move incinerate');
assert.false.holdsItem(holder);
assert.false.fainted(holder);
assert.equal(holder.hp, 1);
});
it('should be consumed and allow its user to survive a confusion damage hit from full HP', function () {
battle = common.createBattle();
battle.setPlayer('p1', {team: [{species: 'Shedinja', ability: 'wonderguard', item: 'focussash', moves: ['absorb']}]});
battle.setPlayer('p2', {team: [{species: 'Klefki', ability: 'prankster', moves: ['confuseray']}]});
const holder = battle.p1.active[0];
battle.makeChoices('move absorb', 'move confuseray');
assert.false.holdsItem(holder);
assert.false.fainted(holder);
assert.equal(holder.hp, 1);
});
it('should not trigger on recoil damage', function () {
battle = common.createBattle();
battle.setPlayer('p1', {team: [{species: 'Shedinja', ability: 'wonderguard', item: 'focussash', moves: ['doubleedge']}]});
battle.setPlayer('p2', {team: [{species: 'Klefki', ability: 'prankster', moves: ['reflect']}]});
const holder = battle.p1.active[0];
battle.makeChoices('move doubleedge', 'move reflect');
assert.holdsItem(holder);
assert.fainted(holder);
});
it('should not trigger on residual damage', function () {
battle = common.createBattle();
battle.setPlayer('p1', {team: [{species: 'Shedinja', ability: 'wonderguard', item: 'focussash', moves: ['sleeptalk']}]});
battle.setPlayer('p2', {team: [{species: 'Crobat', ability: 'infiltrator', moves: ['toxic']}]});
const holder = battle.p1.active[0];
battle.makeChoices('move sleeptalk', 'move toxic');
assert.holdsItem(holder);
assert.fainted(holder);
});
});