diff --git a/src/__tests__/berry.spec.ts b/src/__tests__/berry.spec.ts index 0bac7ed8..20b0d80a 100644 --- a/src/__tests__/berry.spec.ts +++ b/src/__tests__/berry.spec.ts @@ -33,7 +33,9 @@ describe("Berry Client", () => { it("check if it returns a list of berries", async () => { const data = await client.listBerries().then((response: NamedAPIResourceList) => response); + expectTypeOf(data).toEqualTypeOf(); expect(data.results.length).toBeGreaterThan(0); + expect(data.results.length).toBeLessThanOrEqual(20); }); // Berry Firmness @@ -79,5 +81,6 @@ describe("Berry Client", () => { expectTypeOf(data).toEqualTypeOf(); expect(data.results.length).toBeGreaterThan(0); + expect(data.results.length).toBeLessThanOrEqual(20); }); }); diff --git a/src/__tests__/contest.spec.ts b/src/__tests__/contest.spec.ts index d4f811e9..9fd517d3 100644 --- a/src/__tests__/contest.spec.ts +++ b/src/__tests__/contest.spec.ts @@ -34,6 +34,7 @@ describe("Contest Client", () => { expectTypeOf(data).toEqualTypeOf(); expect(data.results.length).toBeGreaterThan(0); + expect(data.results.length).toBeLessThanOrEqual(20); }); // Contest Effect @@ -49,6 +50,7 @@ describe("Contest Client", () => { expectTypeOf(data).toEqualTypeOf(); expect(data.results.length).toBeGreaterThan(0); + expect(data.results.length).toBeLessThanOrEqual(20); }); // Super Contest Effect @@ -58,10 +60,12 @@ describe("Contest Client", () => { expectTypeOf(data).toEqualTypeOf(); expect(data.flavor_text_entries.length).toBeGreaterThan(0); }); + it("check if it returns a list of super contest effects", async () => { const data = await client.listSuperContestEffects(); expectTypeOf(data).toEqualTypeOf(); expect(data.results.length).toBeGreaterThan(0); + expect(data.results.length).toBeLessThanOrEqual(20); }); }); diff --git a/src/__tests__/encounter.spec.ts b/src/__tests__/encounter.spec.ts index 6510f9d9..e3fc686a 100644 --- a/src/__tests__/encounter.spec.ts +++ b/src/__tests__/encounter.spec.ts @@ -39,6 +39,7 @@ describe("Encounter Client", () => { expectTypeOf(data).toEqualTypeOf(); expect(data.results.length).toBeGreaterThan(0); + expect(data.results.length).toBeLessThanOrEqual(20); }); // Encounter Condition @@ -61,6 +62,7 @@ describe("Encounter Client", () => { expectTypeOf(data).toEqualTypeOf(); expect(data.results.length).toBeGreaterThan(0); + expect(data.results.length).toBeLessThanOrEqual(20); }); // Encounter Condition Values @@ -83,5 +85,6 @@ describe("Encounter Client", () => { expectTypeOf(data).toEqualTypeOf(); expect(data.results.length).toBeGreaterThan(0); + expect(data.results.length).toBeLessThanOrEqual(20); }); }); diff --git a/src/__tests__/evolution.spec.ts b/src/__tests__/evolution.spec.ts index f935cc97..6d1b861a 100644 --- a/src/__tests__/evolution.spec.ts +++ b/src/__tests__/evolution.spec.ts @@ -34,6 +34,7 @@ describe("Evolution Client", () => { expectTypeOf(data).toEqualTypeOf(); expect(data.results.length).toBeGreaterThan(0); + expect(data.results.length).toBeLessThanOrEqual(20); }); // Evolution Chain @@ -49,5 +50,6 @@ describe("Evolution Client", () => { expectTypeOf(data).toEqualTypeOf(); expect(data.results.length).toBeGreaterThan(0); + expect(data.results.length).toBeLessThanOrEqual(20); }); }); diff --git a/src/__tests__/game.spec.ts b/src/__tests__/game.spec.ts index e199eede..e97065c4 100644 --- a/src/__tests__/game.spec.ts +++ b/src/__tests__/game.spec.ts @@ -34,6 +34,7 @@ describe("Game Client", () => { expectTypeOf(data).toEqualTypeOf(); expect(data.results.length).toBeGreaterThan(0); + expect(data.results.length).toBeLessThanOrEqual(20); }); // Pokedex @@ -56,6 +57,7 @@ describe("Game Client", () => { expectTypeOf(data).toEqualTypeOf(); expect(data.results.length).toBeGreaterThan(0); + expect(data.results.length).toBeLessThanOrEqual(20); }); // Version @@ -78,6 +80,7 @@ describe("Game Client", () => { expectTypeOf(data).toEqualTypeOf(); expect(data.results.length).toBeGreaterThan(0); + expect(data.results.length).toBeLessThanOrEqual(20); }); // Version Groups @@ -100,5 +103,6 @@ describe("Game Client", () => { expectTypeOf(data).toEqualTypeOf(); expect(data.results.length).toBeGreaterThan(0); + expect(data.results.length).toBeLessThanOrEqual(20); }); }); diff --git a/src/__tests__/item.spec.ts b/src/__tests__/item.spec.ts index 5d4ef5e0..49c76d54 100644 --- a/src/__tests__/item.spec.ts +++ b/src/__tests__/item.spec.ts @@ -41,6 +41,7 @@ describe("Item Client", () => { expectTypeOf(data).toEqualTypeOf(); expect(data.results.length).toBeGreaterThan(0); + expect(data.results.length).toBeLessThanOrEqual(20); }); // Item Attribute @@ -63,6 +64,7 @@ describe("Item Client", () => { expectTypeOf(data).toEqualTypeOf(); expect(data.results.length).toBeGreaterThan(0); + expect(data.results.length).toBeLessThanOrEqual(20); }); // Item Category @@ -86,6 +88,7 @@ describe("Item Client", () => { expectTypeOf(data).toEqualTypeOf(); expect(data.results.length).toBeGreaterThan(0); + expect(data.results.length).toBeLessThanOrEqual(20); }); // Item Fling Effects @@ -108,6 +111,7 @@ describe("Item Client", () => { expectTypeOf(data).toEqualTypeOf(); expect(data.results.length).toBeGreaterThan(0); + expect(data.results.length).toBeLessThanOrEqual(20); }); // Item Pocket @@ -130,5 +134,6 @@ describe("Item Client", () => { expectTypeOf(data).toEqualTypeOf(); expect(data.results.length).toBeGreaterThan(0); + expect(data.results.length).toBeLessThanOrEqual(20); }); }); diff --git a/src/__tests__/location.spec.ts b/src/__tests__/location.spec.ts index 3b609365..d798fd7f 100644 --- a/src/__tests__/location.spec.ts +++ b/src/__tests__/location.spec.ts @@ -34,6 +34,7 @@ describe("Location Client", () => { expectTypeOf(data).toEqualTypeOf(); expect(data.results.length).toBeGreaterThan(0); + expect(data.results.length).toBeLessThanOrEqual(20); }); // Location Area @@ -56,6 +57,7 @@ describe("Location Client", () => { expectTypeOf(data).toEqualTypeOf(); expect(data.results.length).toBeGreaterThan(0); + expect(data.results.length).toBeLessThanOrEqual(20); }); // Pal Park Area @@ -78,6 +80,7 @@ describe("Location Client", () => { expectTypeOf(data).toEqualTypeOf(); expect(data.results.length).toBeGreaterThan(0); + expect(data.results.length).toBeLessThanOrEqual(20); }); // Regions @@ -100,5 +103,6 @@ describe("Location Client", () => { expectTypeOf(data).toEqualTypeOf(); expect(data.results.length).toBeGreaterThan(0); + expect(data.results.length).toBeLessThanOrEqual(20); }); }); diff --git a/src/__tests__/machine.spec.ts b/src/__tests__/machine.spec.ts index 4840bc9a..9e23cca8 100644 --- a/src/__tests__/machine.spec.ts +++ b/src/__tests__/machine.spec.ts @@ -26,5 +26,6 @@ describe("Machine Client", () => { expectTypeOf(data).toEqualTypeOf(); expect(data.results.length).toBeGreaterThan(0); + expect(data.results.length).toBeLessThanOrEqual(20); }); }); diff --git a/src/__tests__/move.spec.ts b/src/__tests__/move.spec.ts index 5dec13c8..df668942 100644 --- a/src/__tests__/move.spec.ts +++ b/src/__tests__/move.spec.ts @@ -50,6 +50,7 @@ describe("Move Client", () => { expectTypeOf(data).toEqualTypeOf(); expect(data.results.length).toBeGreaterThan(0); + expect(data.results.length).toBeLessThanOrEqual(20); }); // Move Ailment @@ -72,6 +73,7 @@ describe("Move Client", () => { expectTypeOf(data).toEqualTypeOf(); expect(data.results.length).toBeGreaterThan(0); + expect(data.results.length).toBeLessThanOrEqual(20); }); // Move Battle Style @@ -94,6 +96,7 @@ describe("Move Client", () => { expectTypeOf(data).toEqualTypeOf(); expect(data.results.length).toBeGreaterThan(0); + expect(data.results.length).toBeLessThanOrEqual(20); }); // Move Category @@ -116,6 +119,7 @@ describe("Move Client", () => { expectTypeOf(data).toEqualTypeOf(); expect(data.results.length).toBeGreaterThan(0); + expect(data.results.length).toBeLessThanOrEqual(20); }); // Move Damage Class @@ -138,6 +142,7 @@ describe("Move Client", () => { expectTypeOf(data).toEqualTypeOf(); expect(data.results.length).toBeGreaterThan(0); + expect(data.results.length).toBeLessThanOrEqual(20); }); // Move Learn Method @@ -160,6 +165,7 @@ describe("Move Client", () => { expectTypeOf(data).toEqualTypeOf(); expect(data.results.length).toBeGreaterThan(0); + expect(data.results.length).toBeLessThanOrEqual(20); }); // Move Target @@ -182,6 +188,7 @@ describe("Move Client", () => { expectTypeOf(data).toEqualTypeOf(); expect(data.results.length).toBeGreaterThan(0); + expect(data.results.length).toBeLessThanOrEqual(20); }); it("check if it returns a list of move targets", async () => { @@ -189,5 +196,6 @@ describe("Move Client", () => { expectTypeOf(data).toEqualTypeOf(); expect(data.results.length).toBeGreaterThan(0); + expect(data.results.length).toBeLessThanOrEqual(20); }); }); diff --git a/src/__tests__/pokemon.spec.ts b/src/__tests__/pokemon.spec.ts index be8be12a..25246b72 100644 --- a/src/__tests__/pokemon.spec.ts +++ b/src/__tests__/pokemon.spec.ts @@ -50,18 +50,22 @@ describe("Pokemon Client", () => { expectTypeOf(data).toEqualTypeOf(); expect(data.id).toBe(1); }); + it("check if it returns an Ability passing an ID", async () => { const data = await client.getAbilityById(1); expectTypeOf(data).toEqualTypeOf(); expect(data.name).toBe("stench"); }); + it("check if it returns a list of abilities", async () => { const data = await client.listAbilities(); expectTypeOf(data).toEqualTypeOf(); expect(data.results.length).toBeGreaterThan(0); + expect(data.results.length).toBeLessThanOrEqual(20); }); + // Characteristic it("check if it returns a Characteristic passing an ID", async () => { const data = await client.getCharacteristicById(1); @@ -69,12 +73,15 @@ describe("Pokemon Client", () => { expectTypeOf(data).toEqualTypeOf(); expect(data.id).toBe(1); }); + it("check if it returns a list of Characteristics", async () => { const data = await client.listCharacteristics(); expectTypeOf(data).toEqualTypeOf(); expect(data.results.length).toBeGreaterThan(0); + expect(data.results.length).toBeLessThanOrEqual(20); }); + // Egg Group it("check if it returns an Egg Group passig a name", async () => { const data = await client.getEggGroupByName("dragon"); @@ -82,18 +89,22 @@ describe("Pokemon Client", () => { expectTypeOf(data).toEqualTypeOf(); expect(data.id).toBe(EGG_GROUPS.DRAGON); }); + it("check if it returns an Egg Group passing an ID", async () => { const data = await client.getEggGroupById(EGG_GROUPS.DITTO); expectTypeOf(data).toEqualTypeOf(); expect(data.name).toBe("ditto"); }); + it("check if it returns a list of Egg Groups", async () => { const data = await client.listEggGroups(); expectTypeOf(data).toEqualTypeOf(); expect(data.results.length).toBeGreaterThan(0); + expect(data.results.length).toBeLessThanOrEqual(20); }); + // Gender it("check if it returns a Gender passig a name", async () => { const data = await client.getGenderByName("male"); @@ -101,18 +112,22 @@ describe("Pokemon Client", () => { expectTypeOf(data).toEqualTypeOf(); expect(data.id).toBe(GENDERS.MALE); }); + it("check if it returns a Gender passing an ID", async () => { const data = await client.getGenderById(GENDERS.FEMALE); expectTypeOf(data).toEqualTypeOf(); expect(data.name).toBe("female"); }); + it("check if it returns a list of Genders", async () => { const data = await client.listGenders(); expectTypeOf(data).toEqualTypeOf(); expect(data.results.length).toBeGreaterThan(0); + expect(data.results.length).toBeLessThanOrEqual(20); }); + // Growth Rate it("check if it returns a Growth Rate passing a name", async () => { const data = await client.getGrowthRateByName("medium"); @@ -120,18 +135,22 @@ describe("Pokemon Client", () => { expectTypeOf(data).toEqualTypeOf(); expect(data.id).toBe(GROWTH_RATES.MEDIUM); }); + it("check if it returns a Growth Rate passing an ID", async () => { const data = await client.getGrowthRateById(GROWTH_RATES.SLOW); expectTypeOf(data).toEqualTypeOf(); expect(data.name).toBe("slow"); }); + it("check if it returns a list of Growth Rates", async () => { const data = await client.listGrowthRates(); expectTypeOf(data).toEqualTypeOf(); expect(data.results.length).toBeGreaterThan(0); + expect(data.results.length).toBeLessThanOrEqual(20); }); + // Nature it("check if it returns a Nature passing a name", async () => { const data = await client.getNatureByName("bashful"); @@ -139,24 +158,29 @@ describe("Pokemon Client", () => { expectTypeOf(data).toEqualTypeOf(); expect(data.id).toBe(NATURES.BASHFUL); }); + it("check if it returns a Nature passing an ID", async () => { const data = await client.getNatureById(13); expectTypeOf(data).toEqualTypeOf(); expect(data.id).toBe(NATURES.BASHFUL); }); + it("check if it returns a Nature passing an ID", async () => { const data = await client.getGrowthRateById(GROWTH_RATES.SLOW); expectTypeOf(data).toEqualTypeOf(); expect(data.name).toBe("slow"); }); + it("check if it returns a list of Natures", async () => { const data = await client.listNatures(); expectTypeOf(data).toEqualTypeOf(); expect(data.results.length).toBeGreaterThan(0); + expect(data.results.length).toBeLessThanOrEqual(20); }); + // Pokeathlon Stat it("check if it returns a Pokeathlon Stat passing a name", async () => { const data = await client.getPokeathlonStatByName("power"); @@ -164,18 +188,22 @@ describe("Pokemon Client", () => { expectTypeOf(data).toEqualTypeOf(); expect(data.id).toBe(POKEATHLON_STATS.POWER); }); + it("check if it returns a Pokeathlon Stat passing an ID", async () => { const data = await client.getPokeathlonStatById(POKEATHLON_STATS.JUMP); expectTypeOf(data).toEqualTypeOf(); expect(data.name).toBe("jump"); }); + it("check if it returns a list of Pokeathlon Stats", async () => { const data = await client.listPokeathlonStats(); expectTypeOf(data).toEqualTypeOf(); expect(data.results.length).toBeGreaterThan(0); + expect(data.results.length).toBeLessThanOrEqual(20); }); + // Pokemon it("check if it returns a Pokemon passing a name", async () => { const data = await client.getPokemonByName("luxray"); @@ -183,24 +211,29 @@ describe("Pokemon Client", () => { expectTypeOf(data).toEqualTypeOf(); expect(data.name).toBe("luxray"); }); + it("check if it returns a Pokemon passing an ID", async () => { const data = await client.getPokemonById(1); expectTypeOf(data).toEqualTypeOf(); expect(data.id).toBe(1); }); + it("check if it returns a Pokemon passing an ID", async () => { const data = await client.getPokeathlonStatById(POKEATHLON_STATS.JUMP); expectTypeOf(data).toEqualTypeOf(); expect(data.name).toBe("jump"); }); + it("check if it returns a list of Pokemon", async () => { const data = await client.listPokemons(); expectTypeOf(data).toEqualTypeOf(); expect(data.results.length).toBeGreaterThan(0); + expect(data.results.length).toBeLessThanOrEqual(20); }); + // Pokemon Location Areas it("check if it returns a Pokemon Location Area passing an ID", async () => { const data = await client.getPokemonLocationAreaById(1); @@ -208,6 +241,7 @@ describe("Pokemon Client", () => { expectTypeOf(data).toEqualTypeOf(); expect(data.length).toBeGreaterThan(0); }); + // Pokemon Colors it("check if it returns a Pokemon Color passing a name", async () => { const data = await client.getPokemonColorByName("pink"); @@ -215,18 +249,22 @@ describe("Pokemon Client", () => { expectTypeOf(data).toEqualTypeOf(); expect(data.id).toBe(POKEMON_COLORS.PINK); }); + it("check if it returns a Pokemon Color passing an ID", async () => { const data = await client.getPokemonColorById(POKEMON_COLORS.BLUE); expectTypeOf(data).toEqualTypeOf(); expect(data.name).toBe("blue"); }); + it("check if it returns a list of Pokemon Colors", async () => { const data = await client.listPokemonColors(); expectTypeOf(data).toEqualTypeOf(); expect(data.results.length).toBeGreaterThan(0); + expect(data.results.length).toBeLessThanOrEqual(20); }); + // Pokemon Forms it("check if it returns a Pokemon Form passing a name", async () => { const data = await client @@ -236,18 +274,22 @@ describe("Pokemon Client", () => { expectTypeOf(data).toEqualTypeOf(); expect(data.id).toBe(1); }); + it("check if it returns a Pokemon Form passing an ID", async () => { const data = await client.getPokemonFormById(1); expectTypeOf(data).toEqualTypeOf(); expect(data.name).toBe("bulbasaur"); }); + it("check if it returns a list of Pokemon Forms", async () => { const data = await client.listPokemonForms(); expectTypeOf(data).toEqualTypeOf(); expect(data.results.length).toBeGreaterThan(0); + expect(data.results.length).toBeLessThanOrEqual(20); }); + // Pokemon Habitat it("check if it returns a Pokemon Habitat passing a name", async () => { const data = await client @@ -257,6 +299,7 @@ describe("Pokemon Client", () => { expectTypeOf(data).toEqualTypeOf(); expect(data.id).toBe(POKEMON_HABITATS.FOREST); }); + it("check if it returns a Pokemon Habitat passing an ID", async () => { const data = await client .getPokemonHabitatById(POKEMON_HABITATS.GRASSLAND) @@ -265,12 +308,15 @@ describe("Pokemon Client", () => { expectTypeOf(data).toEqualTypeOf(); expect(data.name).toBe("grassland"); }); + it("check if it returns a list of Pokemon Habitats", async () => { const data = await client.listPokemonHabitats(); expectTypeOf(data).toEqualTypeOf(); expect(data.results.length).toBeGreaterThan(0); + expect(data.results.length).toBeLessThanOrEqual(20); }); + // Pokemon Shape it("check if it returns a Pokemon Shape passing a name", async () => { const data = await client @@ -280,6 +326,7 @@ describe("Pokemon Client", () => { expectTypeOf(data).toEqualTypeOf(); expect(data.id).toBe(POKEMON_SHAPES.ARMOR); }); + it("check if it returns a Pokemon Shape passing an ID", async () => { const data = await client .getPokemonShapeById(POKEMON_SHAPES.BLOB) @@ -288,12 +335,15 @@ describe("Pokemon Client", () => { expectTypeOf(data).toEqualTypeOf(); expect(data.name).toBe("blob"); }); + it("check if it returns a list of Pokemon Shapes", async () => { const data = await client.listPokemonShapes(); expectTypeOf(data).toEqualTypeOf(); expect(data.results.length).toBeGreaterThan(0); + expect(data.results.length).toBeLessThanOrEqual(20); }); + // Pokemon Species it("check if it returns a Pokemon Species passing a name", async () => { const data = await client.getPokemonSpeciesByName("ivysaur"); @@ -301,18 +351,22 @@ describe("Pokemon Client", () => { expectTypeOf(data).toEqualTypeOf(); expect(data.id).toBe(2); }); + it("check if it returns a Pokemon Species passing an ID", async () => { const data = await client.getPokemonSpeciesById(2); expectTypeOf(data).toEqualTypeOf(); expect(data.name).toBe("ivysaur"); }); + it("check if it returns a list of Pokemon Species", async () => { const data = await client.listPokemonSpecies(); expectTypeOf(data).toEqualTypeOf(); expect(data.results.length).toBeGreaterThan(0); + expect(data.results.length).toBeLessThanOrEqual(20); }); + // Stat it("check if it returns a Stat passing a name", async () => { const data = await client.getStatByName("attack"); @@ -320,18 +374,22 @@ describe("Pokemon Client", () => { expectTypeOf(data).toEqualTypeOf(); expect(data.id).toBe(STATS.ATTACK); }); + it("check if it returns a Stat passing an ID", async () => { const data = await client.getStatById(STATS.DEFENSE); expectTypeOf(data).toEqualTypeOf(); expect(data.name).toBe("defense"); }); + it("check if it returns a list of Stats", async () => { const data = await client.listStats(); expectTypeOf(data).toEqualTypeOf(); expect(data.results.length).toBeGreaterThan(0); + expect(data.results.length).toBeLessThanOrEqual(20); }); + // Types it("check if it returns a Type passing a name", async () => { const data = await client.getTypeByName("dark"); @@ -339,16 +397,19 @@ describe("Pokemon Client", () => { expectTypeOf(data).toEqualTypeOf(); expect(data.id).toBe(TYPES.DARK); }); + it("check if it returns a Type passing an ID", async () => { const data = await client.getTypeById(TYPES.ELECTRIC); expectTypeOf(data).toEqualTypeOf(); expect(data.name).toBe("electric"); }); + it("check if it returns a list of Types", async () => { const data = await client.listTypes(); expectTypeOf(data).toEqualTypeOf(); expect(data.results.length).toBeGreaterThan(0); + expect(data.results.length).toBeLessThanOrEqual(20); }); }); diff --git a/src/__tests__/utility.spec.ts b/src/__tests__/utility.spec.ts index b05724fd..5e7aeee3 100644 --- a/src/__tests__/utility.spec.ts +++ b/src/__tests__/utility.spec.ts @@ -32,6 +32,7 @@ describe("Utility Client", () => { expectTypeOf(data).toEqualTypeOf(); expect(data.results.length).toBeGreaterThan(0); + expect(data.results.length).toBeLessThanOrEqual(20); }); // Resource (pokemon)