remove localization tests

we don't need to test if i18next is working.
This is the job of i18next itself
This commit is contained in:
flx-sta 2024-09-19 11:36:45 -07:00
parent 26d0e80f91
commit 08f2866998
3 changed files with 0 additions and 526 deletions

View File

@ -1,42 +0,0 @@
import { initI18n } from "#app/plugins/i18n";
import { Species } from "#enums/species";
import GameManager from "#test/utils/gameManager";
import i18next from "i18next";
import Phaser from "phaser";
import { afterEach, beforeAll, describe, expect, it } from "vitest";
describe("Lokalization - french", () => {
let phaserGame: Phaser.Game;
let game: GameManager;
beforeAll(() => {
initI18n();
phaserGame = new Phaser.Game({
type: Phaser.HEADLESS,
});
});
afterEach(() => {
game.phaseInterceptor.restoreOg();
});
it("test bulbasaur name english", async () => {
game = new GameManager(phaserGame);
await game.startBattle([
Species.BULBASAUR,
]);
expect(game.scene.getParty()[0].name).toBe("Bulbasaur");
}, 20000);
it("test bulbasaure name french", async () => {
const locale = "fr";
i18next.changeLanguage(locale);
localStorage.setItem("prLang", locale);
game = new GameManager(phaserGame);
await game.startBattle([
Species.BULBASAUR,
]);
expect(game.scene.getParty()[0].name).toBe("Bulbizarre");
}, 20000);
});

View File

@ -1,293 +0,0 @@
import { StatusEffect, getStatusEffectActivationText, getStatusEffectDescriptor, getStatusEffectHealText, getStatusEffectObtainText, getStatusEffectOverlapText } from "#app/data/status-effect";
import { mockI18next } from "#test/utils/testUtils";
import i18next from "i18next";
import { afterEach, beforeAll, describe, expect, it, vi } from "vitest";
const pokemonName = "PKM";
const sourceText = "SOURCE";
describe("status-effect", () => {
beforeAll(() => {
i18next.init();
});
describe("NONE", () => {
const statusEffect = StatusEffect.NONE;
it("should return the obtain text", () => {
mockI18next();
const text = getStatusEffectObtainText(statusEffect, pokemonName);
expect(text).toBe("statusEffect:none.obtain");
const emptySourceText = getStatusEffectObtainText(statusEffect, pokemonName, "");
expect(emptySourceText).toBe("statusEffect:none.obtain");
});
it("should return the source-obtain text", () => {
mockI18next();
const text = getStatusEffectObtainText(statusEffect, pokemonName, sourceText);
expect(text).toBe("statusEffect:none.obtainSource");
const emptySourceText = getStatusEffectObtainText(statusEffect, pokemonName, "");
expect(emptySourceText).not.toBe("statusEffect:none.obtainSource");
});
it("should return the activation text", () => {
mockI18next();
const text = getStatusEffectActivationText(statusEffect, pokemonName);
expect(text).toBe("statusEffect:none.activation");
});
it("should return the overlap text", () => {
mockI18next();
const text = getStatusEffectOverlapText(statusEffect, pokemonName);
expect(text).toBe("statusEffect:none.overlap");
});
it("should return the heal text", () => {
mockI18next();
const text = getStatusEffectHealText(statusEffect, pokemonName);
expect(text).toBe("statusEffect:none.heal");
});
it("should return the descriptor", () => {
mockI18next();
const text = getStatusEffectDescriptor(statusEffect);
expect(text).toBe("statusEffect:none.description");
});
});
describe("POISON", () => {
const statusEffect = StatusEffect.POISON;
it("should return the obtain text", () => {
mockI18next();
const text = getStatusEffectObtainText(statusEffect, pokemonName);
expect(text).toBe("statusEffect:poison.obtain");
const emptySourceText = getStatusEffectObtainText(statusEffect, pokemonName, "");
expect(emptySourceText).toBe("statusEffect:poison.obtain");
});
it("should return the activation text", () => {
mockI18next();
const text = getStatusEffectActivationText(statusEffect, pokemonName);
expect(text).toBe("statusEffect:poison.activation");
});
it("should return the descriptor", () => {
mockI18next();
const text = getStatusEffectDescriptor(statusEffect);
expect(text).toBe("statusEffect:poison.description");
});
it("should return the heal text", () => {
mockI18next();
const text = getStatusEffectHealText(statusEffect, pokemonName);
expect(text).toBe("statusEffect:poison.heal");
});
it("should return the overlap text", () => {
mockI18next();
const text = getStatusEffectOverlapText(statusEffect, pokemonName);
expect(text).toBe("statusEffect:poison.overlap");
});
});
describe("TOXIC", () => {
const statusEffect = StatusEffect.TOXIC;
it("should return the obtain text", () => {
mockI18next();
const text = getStatusEffectObtainText(statusEffect, pokemonName);
expect(text).toBe("statusEffect:toxic.obtain");
const emptySourceText = getStatusEffectObtainText(statusEffect, pokemonName, "");
expect(emptySourceText).toBe("statusEffect:toxic.obtain");
});
it("should return the activation text", () => {
mockI18next();
const text = getStatusEffectActivationText(statusEffect, pokemonName);
expect(text).toBe("statusEffect:toxic.activation");
});
it("should return the descriptor", () => {
mockI18next();
const text = getStatusEffectDescriptor(statusEffect);
expect(text).toBe("statusEffect:toxic.description");
});
it("should return the heal text", () => {
mockI18next();
const text = getStatusEffectHealText(statusEffect, pokemonName);
expect(text).toBe("statusEffect:toxic.heal");
});
it("should return the overlap text", () => {
mockI18next();
const text = getStatusEffectOverlapText(statusEffect, pokemonName);
expect(text).toBe("statusEffect:toxic.overlap");
});
});
describe("PARALYSIS", () => {
const statusEffect = StatusEffect.PARALYSIS;
it("should return the obtain text", () => {
mockI18next();
const text = getStatusEffectObtainText(statusEffect, pokemonName);
expect(text).toBe("statusEffect:paralysis.obtain");
const emptySourceText = getStatusEffectObtainText(statusEffect, pokemonName, "");
expect(emptySourceText).toBe("statusEffect:paralysis.obtain");
});
it("should return the activation text", () => {
mockI18next();
const text = getStatusEffectActivationText(statusEffect, pokemonName);
expect(text).toBe("statusEffect:paralysis.activation");
});
it("should return the descriptor", () => {
mockI18next();
const text = getStatusEffectDescriptor(statusEffect);
expect(text).toBe("statusEffect:paralysis.description");
});
it("should return the heal text", () => {
mockI18next();
const text = getStatusEffectHealText(statusEffect, pokemonName);
expect(text).toBe("statusEffect:paralysis.heal");
});
it("should return the overlap text", () => {
mockI18next();
const text = getStatusEffectOverlapText(statusEffect, pokemonName);
expect(text).toBe("statusEffect:paralysis.overlap");
});
});
describe("SLEEP", () => {
const statusEffect = StatusEffect.SLEEP;
it("should return the obtain text", () => {
mockI18next();
const text = getStatusEffectObtainText(statusEffect, pokemonName);
expect(text).toBe("statusEffect:sleep.obtain");
const emptySourceText = getStatusEffectObtainText(statusEffect, pokemonName, "");
expect(emptySourceText).toBe("statusEffect:sleep.obtain");
});
it("should return the activation text", () => {
mockI18next();
const text = getStatusEffectActivationText(statusEffect, pokemonName);
expect(text).toBe("statusEffect:sleep.activation");
});
it("should return the descriptor", () => {
mockI18next();
const text = getStatusEffectDescriptor(statusEffect);
expect(text).toBe("statusEffect:sleep.description");
});
it("should return the heal text", () => {
mockI18next();
const text = getStatusEffectHealText(statusEffect, pokemonName);
expect(text).toBe("statusEffect:sleep.heal");
});
it("should return the overlap text", () => {
mockI18next();
const text = getStatusEffectOverlapText(statusEffect, pokemonName);
expect(text).toBe("statusEffect:sleep.overlap");
});
});
describe("FREEZE", () => {
const statusEffect = StatusEffect.FREEZE;
it("should return the obtain text", () => {
mockI18next();
const text = getStatusEffectObtainText(statusEffect, pokemonName);
expect(text).toBe("statusEffect:freeze.obtain");
const emptySourceText = getStatusEffectObtainText(statusEffect, pokemonName, "");
expect(emptySourceText).toBe("statusEffect:freeze.obtain");
});
it("should return the activation text", () => {
mockI18next();
const text = getStatusEffectActivationText(statusEffect, pokemonName);
expect(text).toBe("statusEffect:freeze.activation");
});
it("should return the descriptor", () => {
mockI18next();
const text = getStatusEffectDescriptor(statusEffect);
expect(text).toBe("statusEffect:freeze.description");
});
it("should return the heal text", () => {
mockI18next();
const text = getStatusEffectHealText(statusEffect, pokemonName);
expect(text).toBe("statusEffect:freeze.heal");
});
it("should return the overlap text", () => {
mockI18next();
const text = getStatusEffectOverlapText(statusEffect, pokemonName);
expect(text).toBe("statusEffect:freeze.overlap");
});
});
describe("BURN", () => {
const statusEffect = StatusEffect.BURN;
it("should return the obtain text", () => {
mockI18next();
const text = getStatusEffectObtainText(statusEffect, pokemonName);
expect(text).toBe("statusEffect:burn.obtain");
const emptySourceText = getStatusEffectObtainText(statusEffect, pokemonName, "");
expect(emptySourceText).toBe("statusEffect:burn.obtain");
});
it("should return the activation text", () => {
mockI18next();
const text = getStatusEffectActivationText(statusEffect, pokemonName);
expect(text).toBe("statusEffect:burn.activation");
});
it("should return the descriptor", () => {
mockI18next();
const text = getStatusEffectDescriptor(statusEffect);
expect(text).toBe("statusEffect:burn.description");
});
it("should return the heal text", () => {
mockI18next();
const text = getStatusEffectHealText(statusEffect, pokemonName);
expect(text).toBe("statusEffect:burn.heal");
});
it("should return the overlap text", () => {
mockI18next();
const text = getStatusEffectOverlapText(statusEffect, pokemonName);
expect(text).toBe("statusEffect:burn.overlap");
});
});
afterEach(() => {
vi.resetAllMocks();
});
});

View File

@ -1,191 +0,0 @@
import { TerrainType, getTerrainName } from "#app/data/terrain";
import { getTerrainBlockMessage, getTerrainClearMessage, getTerrainStartMessage } from "#app/data/weather";
import { Species } from "#enums/species";
import GameManager from "#test/utils/gameManager";
import { mockI18next } from "#test/utils/testUtils";
import i18next from "i18next";
import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
describe("terrain", () => {
let phaserGame: Phaser.Game;
let game: GameManager;
beforeAll(() => {
phaserGame = new Phaser.Game({
type: Phaser.HEADLESS,
});
i18next.init();
});
beforeEach(() => {
game = new GameManager(phaserGame);
game.override.battleType("single");
});
describe("NONE", () => {
const terrainType = TerrainType.NONE;
it("should return the obtain text", () => {
mockI18next();
const text = getTerrainName(terrainType);
expect(text).toBe("");
});
it("should return the start text", () => {
mockI18next();
const text = getTerrainStartMessage(terrainType);
expect(text).toBeNull();
});
it("should return the clear text", () => {
mockI18next();
const text = getTerrainClearMessage(terrainType);
expect(text).toBeNull();
});
it("should return the block text", async () => {
await game.startBattle([Species.MAGIKARP]);
const pokemon = game.scene.getPlayerPokemon()!;
mockI18next();
const text = getTerrainBlockMessage(pokemon, terrainType);
expect(text).toBe("terrain:defaultBlockMessage");
});
});
describe("MISTY", () => {
const terrainType = TerrainType.MISTY;
it("should return the obtain text", () => {
mockI18next();
const text = getTerrainName(terrainType);
expect(text).toBe("terrain:misty");
});
it("should return the start text", () => {
mockI18next();
const text = getTerrainStartMessage(terrainType);
expect(text).toBe("terrain:mistyStartMessage");
});
it("should return the clear text", () => {
mockI18next();
const text = getTerrainClearMessage(terrainType);
expect(text).toBe("terrain:mistyClearMessage");
});
it("should return the block text", async () => {
await game.startBattle([Species.MAGIKARP]);
const pokemon = game.scene.getPlayerPokemon()!;
mockI18next();
const text = getTerrainBlockMessage(pokemon, terrainType);
expect(text).toBe("terrain:mistyBlockMessage");
});
});
describe("ELECTRIC", () => {
const terrainType = TerrainType.ELECTRIC;
it("should return the obtain text", () => {
mockI18next();
const text = getTerrainName(terrainType);
expect(text).toBe("terrain:electric");
});
it("should return the start text", () => {
mockI18next();
const text = getTerrainStartMessage(terrainType);
expect(text).toBe("terrain:electricStartMessage");
});
it("should return the clear text", () => {
mockI18next();
const text = getTerrainClearMessage(terrainType);
expect(text).toBe("terrain:electricClearMessage");
});
it("should return the block text", async () => {
await game.startBattle([Species.MAGIKARP]);
const pokemon = game.scene.getPlayerPokemon()!;
mockI18next();
const text = getTerrainBlockMessage(pokemon, terrainType);
expect(text).toBe("terrain:defaultBlockMessage");
});
});
describe("GRASSY", () => {
const terrainType = TerrainType.GRASSY;
it("should return the obtain text", () => {
mockI18next();
const text = getTerrainName(terrainType);
expect(text).toBe("terrain:grassy");
});
it("should return the start text", () => {
mockI18next();
const text = getTerrainStartMessage(terrainType);
expect(text).toBe("terrain:grassyStartMessage");
});
it("should return the clear text", () => {
mockI18next();
const text = getTerrainClearMessage(terrainType);
expect(text).toBe("terrain:grassyClearMessage");
});
it("should return the block text", async () => {
await game.startBattle([Species.MAGIKARP]);
const pokemon = game.scene.getPlayerPokemon()!;
mockI18next();
const text = getTerrainBlockMessage(pokemon, terrainType);
expect(text).toBe("terrain:defaultBlockMessage");
});
});
describe("PSYCHIC", () => {
const terrainType = TerrainType.PSYCHIC;
it("should return the obtain text", () => {
mockI18next();
const text = getTerrainName(terrainType);
expect(text).toBe("terrain:psychic");
});
it("should return the start text", () => {
mockI18next();
const text = getTerrainStartMessage(terrainType);
expect(text).toBe("terrain:psychicStartMessage");
});
it("should return the clear text", () => {
mockI18next();
const text = getTerrainClearMessage(terrainType);
expect(text).toBe("terrain:psychicClearMessage");
});
it("should return the block text", async () => {
await game.startBattle([Species.MAGIKARP]);
const pokemon = game.scene.getPlayerPokemon()!;
mockI18next();
const text = getTerrainBlockMessage(pokemon, terrainType);
expect(text).toBe("terrain:defaultBlockMessage");
});
});
afterEach(() => {
game.phaseInterceptor.restoreOg();
vi.resetAllMocks();
});
});