Add a test for self-damage critical hits (#4954)

This commit is contained in:
Konrad Borowski
2018-11-04 17:55:49 +01:00
committed by Guangcong Luo
parent 09700645de
commit 09360e88ca

View File

@@ -0,0 +1,21 @@
'use strict';
const assert = require('./../../assert');
const common = require('./../../common');
let battle;
describe('Critical hits', function () {
afterEach(function () {
battle.destroy();
});
it('should not happen on self-hits', function () {
battle = common.createBattle();
battle.join('p1', 'Guest 1', 1, [{species: "Zubat", moves: ['confuseray']}]);
battle.join('p2', 'Guest 2', 1, [{species: "Chansey", item: 'luckypunch', ability: 'superluck', moves: ['softboiled']}]);
battle.makeChoices('move confuseray', 'move softboiled');
assert(battle.log.some(line => line.includes('[from] confusion')));
assert(battle.log.every(line => !line.startsWith('|-crit')));
});
});