Spaces:
Running
Running
File size: 4,242 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 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
/**
* Tests for the Data Search chat plugin
*/
'use strict';
const assert = require('../../assert').strict;
const datasearch = require('../../../dist/server/chat-plugins/datasearch');
describe("Datasearch Plugin", () => {
it('should return pokemon with pivot moves', async () => {
const cmd = 'ds';
const target = 'pivot|batonpass, mod=gen8';
const dexSearch = datasearch.testables.runDexsearch(target, cmd, true, `/${cmd} ${target}`, true);
assert(dexSearch.results.includes('Absol'));
});
it('should return pokemon with pivot moves, but not baton pass', async () => {
const cmd = 'ds';
const target = 'pivot, mod=gen8';
const dexSearch = datasearch.testables.runDexsearch(target, cmd, true, `/${cmd} ${target}`, true);
assert.false(dexSearch.results.includes('Absol'));
assert(dexSearch.results.includes('Abra'));
});
it('should return pivot moves', async () => {
const cmd = 'ms';
const target = 'pivot';
const moveSearch = datasearch.testables.runMovesearch(target, cmd, true, `/${cmd} ${target}`, true);
assert(moveSearch.results.includes('U-turn'));
});
it('should not return pivot moves', async () => {
const cmd = 'ms';
const target = '!pivot';
const moveSearch = datasearch.testables.runMovesearch(target, cmd, true, `/${cmd} ${target}`, true);
assert.false(moveSearch.results.includes('U-turn'));
});
it('should error', async () => {
const cmd = 'ms';
const target = 'pivot|!pivot';
const moveSearch = datasearch.testables.runMovesearch(target, cmd, true, `/${cmd} ${target}`, true);
assert(moveSearch.error);
});
it('should return recoil moves', async () => {
const cmd = 'ms';
const target = 'recoil';
const moveSearch = datasearch.testables.runMovesearch(target, cmd, true, `/${cmd} ${target}`, true);
assert(moveSearch.results.includes('Brave Bird'));
});
it('should not return recoil moves', async () => {
const cmd = 'ms';
const target = '!recoil';
const moveSearch = datasearch.testables.runMovesearch(target, cmd, true, `/${cmd} ${target}`, true);
assert.false(moveSearch.results.includes('Brave Bird'));
});
it('should return recovery moves', async () => {
const cmd = 'ms';
const target = 'recovery';
const moveSearch = datasearch.testables.runMovesearch(target, cmd, true, `/${cmd} ${target}`, true);
assert(moveSearch.results.includes('Absorb'));
});
it('should not return recovery moves', async () => {
const cmd = 'ms';
const target = '!recovery';
const moveSearch = datasearch.testables.runMovesearch(target, cmd, true, `/${cmd} ${target}`, true);
assert.false(moveSearch.results.includes('Absorb'));
});
it('should return zrecovery moves', async () => {
const cmd = 'ms';
const target = 'zrecovery';
const moveSearch = datasearch.testables.runMovesearch(target, cmd, true, `/${cmd} ${target}`, true);
assert(moveSearch.results.includes('Belly Drum'));
});
it('should not return zrecovery moves', async () => {
const cmd = 'ms';
const target = '!zrecovery';
const moveSearch = datasearch.testables.runMovesearch(target, cmd, true, `/${cmd} ${target}`, true);
assert.false(moveSearch.results.includes('Belly Drum'));
});
it('should include result where query string in ability is adjacent to special character', () => {
const cmd = 'as';
const target = 'water';
const abilitySearch = datasearch.testables.runAbilitysearch(target, cmd, true, `/${cmd} ${target}`);
assert(abilitySearch.reply.includes('Steam Engine'));
});
it('should exclude formes where the base Pokemon is included', () => {
const cmd = 'ds';
const target = 'ice, monotype';
const search = datasearch.testables.runDexsearch(target, cmd, true, `/${cmd} ${target}`);
assert.false(search.reply.includes('Eiscue-Noice'));
});
it('should include formes if a sort differentiates them from the base Pokemon', () => {
const cmd = 'ds';
let target = 'ice, monotype, spe desc';
let search = datasearch.testables.runDexsearch(target, cmd, true, `/${cmd} ${target}`);
assert(search.reply.includes('Eiscue-Noice'));
target = 'ice, monotype, hp desc';
search = datasearch.testables.runDexsearch(target, cmd, true, `/${cmd} ${target}`);
assert.false(search.reply.includes('Eiscue-Noice'));
});
});
|