-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
A few are outdated and should be fixed (I fixed some too!)
- Loading branch information
1 parent
601ce94
commit 6ebf860
Showing
16 changed files
with
510 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
var should = require("should"); | ||
|
||
var {AbilityInfo} = require('../app/assets/javascript/pokeinfo'); | ||
import pokedex from "../app/assets/javascript/pokedex"; | ||
|
||
describe('abilityinfo', function () { | ||
describe('.list', function () { | ||
it('should return the list of abilities', function () { | ||
AbilityInfo.list().should.equal(pokedex.abilities.abilities); | ||
}); | ||
}); | ||
describe('.name', function () { | ||
it("should return the ability's name", function () { | ||
AbilityInfo.name(62).should.equal('Guts'); | ||
AbilityInfo.name(105).should.equal('Super Luck'); | ||
AbilityInfo.name(141).should.equal('Moody'); | ||
AbilityInfo.name(171).should.equal('Fur Coat'); | ||
AbilityInfo.name(187).should.equal('Magician'); | ||
}); | ||
}); | ||
describe('.desc', function () { | ||
it("should return the ability's description", function () { | ||
AbilityInfo.desc(62).should.equal("Boosts Attack if there is a status problem."); | ||
AbilityInfo.desc(105).should.equal("Heightens the critical-hit ratios of moves."); | ||
AbilityInfo.desc(141).should.equal("Raises a random stat two stages and lowers another one stage after each turn."); | ||
// Unimplemented | ||
//AbilityInfo.desc(171).should.equal(''); | ||
//AbilityInfo.desc(187).should.equal(''); | ||
}); | ||
}); | ||
describe('.message', function () { | ||
it("should return an empty string if the ability doesn't have a message", function () { | ||
AbilityInfo.message(-1).should.equal(''); | ||
AbilityInfo.message(Object.keys(pokedex.abilities.abilities).length).should.equal(''); | ||
}); | ||
it("should return the ability's message", function () { | ||
// Wonder Guard | ||
AbilityInfo.message(71).should.equal("%s's Wonder Guard evades the attack!"); | ||
// Flash Fire | ||
AbilityInfo.message(19).should.equal("%s's Flash Fire raised the power of its Fire-type moves!"); | ||
AbilityInfo.message(19, 1).should.equal("%s's Flash Fire made %m ineffective!"); | ||
}); | ||
it("it should return an empty string if the requested part doesn't exist", function () { | ||
// Defiant - Defiant sharply raised %s's Attack! | ||
AbilityInfo.message(80, 1).should.equal(''); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
var should = require("should"); | ||
|
||
import {GenderInfo} from "../app/assets/javascript/pokeinfo"; | ||
|
||
describe('genderinfo', function () { | ||
describe('.name', function () { | ||
it("should return the gender's name", function () { | ||
GenderInfo.name(1).should.equal('male'); | ||
GenderInfo.name(2).should.equal('female'); | ||
GenderInfo.name(3).should.equal('neutral'); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
var should = require("should"); | ||
|
||
import {GenInfo} from "../app/assets/javascript/pokeinfo"; | ||
import pokedex from "../app/assets/javascript/pokedex"; | ||
|
||
describe('geninfo', function () { | ||
var numGens = GenInfo.lastGen.num; | ||
|
||
describe('.getGen', function () { | ||
it('should convert non-objects', function () { | ||
GenInfo.getGen(1).should.eql({num: 1, subnum: 0}); | ||
GenInfo.getGen(6).should.eql({num: 6, subnum: 0}); | ||
}); | ||
it('should range test generations', function () { | ||
GenInfo.getGen(-1).should.eql({num: 7, subnum: 0}); | ||
GenInfo.getGen(numGens + 1).should.eql({num: 7, subnum: 0}); | ||
}); | ||
it('should not range test generations if correct is false', function () { | ||
GenInfo.getGen(-1, false).should.eql({num: -1}); | ||
GenInfo.getGen(numGens + 1, false).should.eql({num: numGens + 1}); | ||
GenInfo.getGen(undefined, false).should.eql({num: undefined}); | ||
}); | ||
}); | ||
describe('.list', function () { | ||
it('should return the list of versions', function () { | ||
Object.assign(...GenInfo.list().map(d => ({[d]: GenInfo.version(d)}))).should.eql(pokedex.gens.versions); | ||
GenInfo.list().length.should.equal(Object.keys(pokedex.gens.versions).length); | ||
}); | ||
}); | ||
describe('.name', function () { | ||
it('should return the generation name if it exists', function () { | ||
GenInfo.name(3).should.equal("Generation 3"); | ||
GenInfo.name({num: 4}).should.equal("Generation 4"); | ||
GenInfo.name(6).should.equal("Generation 6"); | ||
should(GenInfo.name(-1)).equal(undefined); | ||
should(GenInfo.name({num: "Generation 1"})).equal(undefined); | ||
}); | ||
}); | ||
describe('.options', function () { | ||
it('should return the list of generation options', function () { | ||
GenInfo.options().should.equal(pokedex.generations.options); | ||
Object.keys(GenInfo.options()).length.should.equal(numGens); | ||
}); | ||
}); | ||
describe('.option', function () { | ||
it('should return options specific to a generation if given', function () { | ||
GenInfo.option(1).sprite_folder.should.equal('http://pokemon-online.eu/images/pokemon/red-blue/'); | ||
GenInfo.option(2).ability.should.equal(false); | ||
GenInfo.option({num: 4}).gender.should.equal(true); | ||
should(GenInfo.option(-1)).equal(undefined); | ||
GenInfo.option(6).animated.should.equal(true); | ||
GenInfo.option(7).animated.should.equal(false); | ||
}); | ||
}); | ||
describe('.hasOption', function () { | ||
it('should return true or false depending on if given gen has that option enabled', function () { | ||
GenInfo.hasOption(1, 'sprite_folder').should.equal(true); | ||
GenInfo.hasOption(2, 'ability').should.equal(false); | ||
GenInfo.hasOption({num: 4}, 'gender').should.equal(true); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--require should | ||
--reporter spec | ||
--ui bdd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
var should = require("should"); | ||
|
||
import {MoveInfo} from '../app/assets/javascript/pokeinfo'; | ||
import '../app/assets/javascript/pokedex-full'; | ||
|
||
describe('moveinfo', function () { | ||
describe('.accuracy', function () { | ||
it('should resolve data from older/newer gens when not found', function () { | ||
MoveInfo.accuracy(3, 1).should.equal(85); | ||
}); | ||
}); | ||
describe('.category', function () { | ||
it('should resolve data from older/newer gens when not found', function () { | ||
MoveInfo.category(44, 3).should.equal(1); | ||
}); | ||
}); | ||
describe('.effect', function () { | ||
it('should resolve data from older/newer gens when not found', function () { | ||
MoveInfo.effect(34, 4).should.equal("Has a $effect_chance% chance to paralyze the target."); | ||
}); | ||
}); | ||
describe('.pp', function () { | ||
it('should resolve data from older/newer gens when not found', function () { | ||
MoveInfo.pp(26, 2).should.equal(25); | ||
}); | ||
}); | ||
describe('.type', function () { | ||
it('should resolve data from older/newer gens when not found', function () { | ||
// Flower Shield | ||
MoveInfo.type(592).should.equal(17); | ||
}); | ||
}); | ||
describe('.power', function () { | ||
it('should resolve data from older/newer gens when not found', function () { | ||
MoveInfo.power(143, 2).should.equal(140); | ||
}); | ||
it("should use the given gen's data", function () { | ||
// Crabhammer: 90 in 5th, 100 in 6th | ||
MoveInfo.power(152, 5).should.equal(90); | ||
MoveInfo.power(152, 6).should.equal(100); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
var should = require("should"); | ||
|
||
import {PokeInfo} from '../app/assets/javascript/pokeinfo'; | ||
import '../app/assets/javascript/pokedex-full'; | ||
|
||
describe('pokeinfo', function () { | ||
describe('.toNum', function () { | ||
it('should return a number if given one', function () { | ||
PokeInfo.toNum(40).should.equal(40); | ||
}); | ||
it('should deal with formes', function () { | ||
PokeInfo.toNum({num: 3, forme: 1}).should.equal((1 << 16) + 3); | ||
}); | ||
}); | ||
|
||
describe('.toArray', function () { | ||
it('should convert numbers to arrays', function () { | ||
PokeInfo.toArray(493).should.eql([493, 0]); | ||
PokeInfo.toArray(200).should.eql([200, 0]); | ||
}); | ||
it('should convert strings to arrays', function () { | ||
PokeInfo.toArray("493").should.eql([493, 0]); | ||
PokeInfo.toArray("493-2").should.eql([493, 2]); | ||
PokeInfo.toArray("262637").should.eql([493, 4]); | ||
}); | ||
it('should fix up arrays', function () { | ||
PokeInfo.toArray(["493", "0"]).should.eql([493, 0]); | ||
}); | ||
}); | ||
|
||
describe('.types', function () { | ||
it('should resolve data from older/newer gens when not found', function () { | ||
// Pidgeot | ||
PokeInfo.types(18, 4).should.eql([0, 2]); // Normal Flying | ||
|
||
// Clefairy in gen 1 | ||
PokeInfo.types(35, 1).should.eql([0]); // Normal | ||
// Clefairy in gen 6 | ||
PokeInfo.types(35).should.eql([17]); // Fairy | ||
|
||
// Retest, to make sure internal expand didn't touch anything | ||
// Clefairy in gen 1 | ||
PokeInfo.types(35, 1).should.eql([0]); // Normal | ||
// Clefairy in gen 6 | ||
PokeInfo.types(35).should.eql([17]); // Fairy | ||
}); | ||
}); | ||
|
||
describe('.stats', function () { | ||
it("should use the given gen's data", function () { | ||
// Butterfree | ||
PokeInfo.stats(12, 3).should.eql([60, 45, 50, 80, 80, 70]); | ||
PokeInfo.stats(12, 6).should.eql([60, 45, 50, 90, 80, 70]); | ||
}); | ||
}); | ||
|
||
describe('.sprite', function () { | ||
it('should generate sprite urls from parameters', function () { | ||
PokeInfo.sprite({num: 1, gen: 6}).should.equal("http://pokemon-online.eu/images/pokemon/x-y/animated/001.gif"); | ||
PokeInfo.sprite({num: 1, gen: {num: 6}}).should.equal("http://pokemon-online.eu/images/pokemon/x-y/animated/001.gif"); | ||
PokeInfo.sprite({num: 1}).should.equal("http://pokemon-online.eu/images/pokemon/x-y/animated/001.gif"); | ||
PokeInfo.sprite({num: 3, forme: 1, gen: {num: 6}}).should.equal("http://pokemon-online.eu/images/pokemon/x-y/animated/003-1.gif"); | ||
PokeInfo.sprite({num: 3, forme: 1, gen: {num: 6}}, {back: true}).should.equal("http://pokemon-online.eu/images/pokemon/x-y/animated/back/003-1.gif"); | ||
}); | ||
}); | ||
|
||
describe('.trainerSprite', function () { | ||
it('should generate sprite urls from parameters', function () { | ||
PokeInfo.trainerSprite(200).should.equal('http://pokemon-online.eu/images/trainers/200.png'); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.