File size: 1,339 Bytes
5c2ed06
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
'use strict';

const assert = require('./../../assert');
const common = require('./../../common');

let battle;

describe('Conversion2', () => {
	afterEach(() => {
		battle.destroy();
	});

	it('should change users type to resist', () => {
		battle = common.createBattle([
			[{ species: 'porygon2', moves: ['sleeptalk', 'conversion2', 'spore'] }],
			[{ species: 'raticate', moves: ['tackle'] },
				{ species: 'zapdos', moves: ['thundershock', 'sleeptalk'] }],
		]);

		battle.makeChoices('move conversion2', 'move tackle');
		assert(['Rock', 'Ghost', 'Steel'].includes(battle.p1.active[0].getTypes()[0]));
		battle.makeChoices('move spore', 'switch 2');
		battle.makeChoices('move conversion2', 'move sleeptalk');
		assert(['Electric', 'Grass', 'Ground', 'Dragon'].includes(battle.p1.active[0].getTypes()[0]), 'should change type based on submove');
	});

	it('should respect the determined type of the last move', () => {
		battle = common.createBattle([
			[{ species: 'porygon2', moves: ['electrify', 'conversion2'] }],
			[{ species: 'shuckle', moves: ['tackle'] }],
		]);

		battle.makeChoices('move electrify', 'move tackle');
		battle.makeChoices('move conversion2', 'move tackle');
		assert(['Electric', 'Grass', 'Ground', 'Dragon'].includes(battle.p1.active[0].getTypes()[0]), 'Tackle should be considered Electric');
	});
});