File size: 2,103 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
'use strict';

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

let battle;

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

	it('should hide formes of certain Pokemon', () => {
		battle = common.createBattle([[
			{ species: 'Pumpkaboo-Super', ability: 'pickup', moves: ['sleeptalk'] },
			{ species: 'Gourgeist-Small', ability: 'pickup', moves: ['sleeptalk'] },
			{ species: 'Dudunsparce-Three-Segment', ability: 'runaway', moves: ['sleeptalk'] },
		], [
			{ species: 'Silvally', ability: 'rkssystem', moves: ['sleeptalk'] },
			{ species: 'Urshifu-Rapid-Strike', ability: 'unseenfist', moves: ['sleeptalk'] },
			{ species: 'Zacian', ability: 'intrepidsword', item: 'rustedsword', moves: ['sleeptalk'] },
		]]);
		for (const line of battle.log) {
			if (line.startsWith('|poke|')) {
				const details = line.split('|')[3];
				assert(details.match(/(Pumpkaboo|Gourgeist|Silvally|Urshifu|Zacian|Dudunsparce)-\*/), `Forme was not hidden; preview details: ${details}`);
			}
		}
	});

	it('should hide Arceus formes [Gen 8]', () => {
		battle = common.createBattle({ formatid: 'gen8anythinggoes' }, [[
			{ species: 'Arceus-Steel', ability: 'multitype', item: 'steelplate', moves: ['sleeptalk'] },
		], [
			{ species: 'Arceus-Fire', ability: 'multitype', item: 'flameplate', moves: ['sleeptalk'] },
		]]);
		for (const line of battle.log) {
			if (line.startsWith('|poke|')) {
				const details = line.split('|')[3];
				assert(details.match(/Arceus-\*/), `Forme was not hidden; preview details: ${details}`);
			}
		}
	});

	it('should not hide formes of hacked Zacian/Zamazenta formes', () => {
		battle = common.createBattle([[
			{ species: 'Zacian-Crowned', moves: ['sleeptalk'] },
		], [
			{ species: 'Zamazenta-Crowned', moves: ['sleeptalk'] },
		]]);
		for (const line of battle.log) {
			if (line.startsWith('|poke|')) {
				const details = line.split('|')[3];
				assert.false(details.includes('-*'), `Forme was hidden; preview details: ${details}`);
			}
		}
	});
});