fix: tests that have to use the i18next key now

instead of the english translation
This commit is contained in:
flx-sta 2024-09-19 12:47:13 -07:00
parent 962fa6e0e4
commit 68f7723c23
12 changed files with 90 additions and 87 deletions

View File

@ -47,6 +47,6 @@ describe("Ability Timing", () => {
await game.phaseInterceptor.to("MessagePhase"); await game.phaseInterceptor.to("MessagePhase");
const message = game.textInterceptor.getLatestMessage(); const message = game.textInterceptor.getLatestMessage();
expect(message).toContain("Attack fell"); expect(message).toContain("battle:statFell");
}, 5000); }, 5000);
}); });

View File

@ -58,11 +58,10 @@ describe("Items - Toxic orb", () => {
// Toxic orb should trigger here // Toxic orb should trigger here
await game.phaseInterceptor.run(MessagePhase); await game.phaseInterceptor.run(MessagePhase);
const message = game.textInterceptor.getLatestMessage(); const message = game.textInterceptor.getLatestMessage();
expect(message).toContain("was badly poisoned by the Toxic Orb"); expect(message).toContain("statusEffect:toxic.obtainSource");
await game.phaseInterceptor.run(MessagePhase); await game.phaseInterceptor.run(MessagePhase);
const message2 = game.textInterceptor.getLatestMessage(); const message2 = game.textInterceptor.getLatestMessage();
expect(message2).toContain("is hurt"); expect(message2).toBe("statusEffect:toxic.activation");
expect(message2).toContain("by poison");
expect(game.scene.getParty()[0].status!.effect).toBe(StatusEffect.TOXIC); expect(game.scene.getParty()[0].status!.effect).toBe(StatusEffect.TOXIC);
}, 20000); }, 20000);
}); });

View File

@ -122,7 +122,7 @@ describe("A Trainer's Test - Mystery Encounter", () => {
expect(scene.getCurrentPhase()?.constructor.name).toBe(CommandPhase.name); expect(scene.getCurrentPhase()?.constructor.name).toBe(CommandPhase.name);
expect(enemyField.length).toBe(1); expect(enemyField.length).toBe(1);
expect(scene.currentBattle.trainer).toBeDefined(); expect(scene.currentBattle.trainer).toBeDefined();
expect(["buck", "cheryl", "marley", "mira", "riley"].includes(scene.currentBattle.trainer!.config.name.toLowerCase())).toBeTruthy(); expect(["trainerNames:buck", "trainerNames:cheryl", "trainerNames:marley", "trainerNames:mira", "trainerNames:riley"].includes(scene.currentBattle.trainer!.config.name)).toBeTruthy();
expect(enemyField[0]).toBeDefined(); expect(enemyField[0]).toBeDefined();
}); });

View File

@ -109,8 +109,8 @@ describe("An Offer You Can't Refuse - Mystery Encounter", () => {
expect(AnOfferYouCantRefuseEncounter.dialogueTokens?.strongestPokemon).toBeDefined(); expect(AnOfferYouCantRefuseEncounter.dialogueTokens?.strongestPokemon).toBeDefined();
expect(AnOfferYouCantRefuseEncounter.dialogueTokens?.price).toBeDefined(); expect(AnOfferYouCantRefuseEncounter.dialogueTokens?.price).toBeDefined();
expect(AnOfferYouCantRefuseEncounter.dialogueTokens?.option2PrimaryAbility).toBe("Intimidate"); expect(AnOfferYouCantRefuseEncounter.dialogueTokens?.option2PrimaryAbility).toBe("ability:intimidate.name");
expect(AnOfferYouCantRefuseEncounter.dialogueTokens?.moveOrAbility).toBe("Intimidate"); expect(AnOfferYouCantRefuseEncounter.dialogueTokens?.moveOrAbility).toBe("ability:intimidate.name");
expect(AnOfferYouCantRefuseEncounter.misc.pokemon instanceof PlayerPokemon).toBeTruthy(); expect(AnOfferYouCantRefuseEncounter.misc.pokemon instanceof PlayerPokemon).toBeTruthy();
expect(AnOfferYouCantRefuseEncounter.misc?.price?.toString()).toBe(AnOfferYouCantRefuseEncounter.dialogueTokens?.price); expect(AnOfferYouCantRefuseEncounter.misc?.price?.toString()).toBe(AnOfferYouCantRefuseEncounter.dialogueTokens?.price);
expect(onInitResult).toBe(true); expect(onInitResult).toBe(true);

View File

@ -14,6 +14,7 @@ import { Moves } from "#enums/moves";
import { SelectModifierPhase } from "#app/phases/select-modifier-phase"; import { SelectModifierPhase } from "#app/phases/select-modifier-phase";
import { Mode } from "#app/ui/ui"; import { Mode } from "#app/ui/ui";
import ModifierSelectUiHandler from "#app/ui/modifier-select-ui-handler"; import ModifierSelectUiHandler from "#app/ui/modifier-select-ui-handler";
import i18next from "i18next";
const namespace = "mysteryEncounter:fieldTrip"; const namespace = "mysteryEncounter:fieldTrip";
const defaultParty = [Species.LAPRAS, Species.GENGAR, Species.ABRA]; const defaultParty = [Species.LAPRAS, Species.GENGAR, Species.ABRA];
@ -118,11 +119,11 @@ describe("Field Trip - Mystery Encounter", () => {
expect(scene.ui.getMode()).to.equal(Mode.MODIFIER_SELECT); expect(scene.ui.getMode()).to.equal(Mode.MODIFIER_SELECT);
const modifierSelectHandler = scene.ui.handlers.find(h => h instanceof ModifierSelectUiHandler) as ModifierSelectUiHandler; const modifierSelectHandler = scene.ui.handlers.find(h => h instanceof ModifierSelectUiHandler) as ModifierSelectUiHandler;
expect(modifierSelectHandler.options.length).toEqual(5); expect(modifierSelectHandler.options.length).toEqual(5);
expect(modifierSelectHandler.options[0].modifierTypeOption.type.name).toBe("X Attack"); expect(modifierSelectHandler.options[0].modifierTypeOption.type.name).toBe("modifierType:TempStatStageBoosterItem.x_attack");
expect(modifierSelectHandler.options[1].modifierTypeOption.type.name).toBe("X Defense"); expect(modifierSelectHandler.options[1].modifierTypeOption.type.name).toBe("modifierType:TempStatStageBoosterItem.x_defense");
expect(modifierSelectHandler.options[2].modifierTypeOption.type.name).toBe("X Speed"); expect(modifierSelectHandler.options[2].modifierTypeOption.type.name).toBe("modifierType:TempStatStageBoosterItem.x_speed");
expect(modifierSelectHandler.options[3].modifierTypeOption.type.name).toBe("Dire Hit"); expect(modifierSelectHandler.options[3].modifierTypeOption.type.name).toBe("modifierType:ModifierType.DIRE_HIT.name");
expect(modifierSelectHandler.options[4].modifierTypeOption.type.name).toBe("Rarer Candy"); expect(modifierSelectHandler.options[4].modifierTypeOption.type.name).toBe("modifierType:ModifierType.RARER_CANDY.name");
}); });
it("should leave encounter without battle", async () => { it("should leave encounter without battle", async () => {
@ -165,11 +166,11 @@ describe("Field Trip - Mystery Encounter", () => {
expect(scene.ui.getMode()).to.equal(Mode.MODIFIER_SELECT); expect(scene.ui.getMode()).to.equal(Mode.MODIFIER_SELECT);
const modifierSelectHandler = scene.ui.handlers.find(h => h instanceof ModifierSelectUiHandler) as ModifierSelectUiHandler; const modifierSelectHandler = scene.ui.handlers.find(h => h instanceof ModifierSelectUiHandler) as ModifierSelectUiHandler;
expect(modifierSelectHandler.options.length).toEqual(5); expect(modifierSelectHandler.options.length).toEqual(5);
expect(modifierSelectHandler.options[0].modifierTypeOption.type.name).toBe("X Sp. Atk"); expect(modifierSelectHandler.options[0].modifierTypeOption.type.name).toBe("modifierType:TempStatStageBoosterItem.x_sp_atk");
expect(modifierSelectHandler.options[1].modifierTypeOption.type.name).toBe("X Sp. Def"); expect(modifierSelectHandler.options[1].modifierTypeOption.type.name).toBe("modifierType:TempStatStageBoosterItem.x_sp_def");
expect(modifierSelectHandler.options[2].modifierTypeOption.type.name).toBe("X Speed"); expect(modifierSelectHandler.options[2].modifierTypeOption.type.name).toBe("modifierType:TempStatStageBoosterItem.x_speed");
expect(modifierSelectHandler.options[3].modifierTypeOption.type.name).toBe("Dire Hit"); expect(modifierSelectHandler.options[3].modifierTypeOption.type.name).toBe("modifierType:ModifierType.DIRE_HIT.name");
expect(modifierSelectHandler.options[4].modifierTypeOption.type.name).toBe("Rarer Candy"); expect(modifierSelectHandler.options[4].modifierTypeOption.type.name).toBe("modifierType:ModifierType.RARER_CANDY.name");
}); });
it("should leave encounter without battle", async () => { it("should leave encounter without battle", async () => {
@ -205,6 +206,7 @@ describe("Field Trip - Mystery Encounter", () => {
}); });
it("Should give proper rewards on correct Special move option", async () => { it("Should give proper rewards on correct Special move option", async () => {
vi.spyOn(i18next, "t");
await game.runToMysteryEncounter(MysteryEncounterType.FIELD_TRIP, defaultParty); await game.runToMysteryEncounter(MysteryEncounterType.FIELD_TRIP, defaultParty);
await runMysteryEncounterToEnd(game, 3, { pokemonNo: 1, optionNo: 3 }); await runMysteryEncounterToEnd(game, 3, { pokemonNo: 1, optionNo: 3 });
await game.phaseInterceptor.to(SelectModifierPhase); await game.phaseInterceptor.to(SelectModifierPhase);
@ -212,11 +214,12 @@ describe("Field Trip - Mystery Encounter", () => {
expect(scene.ui.getMode()).to.equal(Mode.MODIFIER_SELECT); expect(scene.ui.getMode()).to.equal(Mode.MODIFIER_SELECT);
const modifierSelectHandler = scene.ui.handlers.find(h => h instanceof ModifierSelectUiHandler) as ModifierSelectUiHandler; const modifierSelectHandler = scene.ui.handlers.find(h => h instanceof ModifierSelectUiHandler) as ModifierSelectUiHandler;
expect(modifierSelectHandler.options.length).toEqual(5); expect(modifierSelectHandler.options.length).toEqual(5);
expect(modifierSelectHandler.options[0].modifierTypeOption.type.name).toBe("X Accuracy"); expect(modifierSelectHandler.options[0].modifierTypeOption.type.name).toBe("modifierType:TempStatStageBoosterItem.x_accuracy");
expect(modifierSelectHandler.options[1].modifierTypeOption.type.name).toBe("X Speed"); expect(modifierSelectHandler.options[1].modifierTypeOption.type.name).toBe("modifierType:TempStatStageBoosterItem.x_speed");
expect(modifierSelectHandler.options[2].modifierTypeOption.type.name).toBe("5x Great Ball"); expect(modifierSelectHandler.options[2].modifierTypeOption.type.name).toBe("modifierType:ModifierType.AddPokeballModifierType.name");
expect(modifierSelectHandler.options[3].modifierTypeOption.type.name).toBe("IV Scanner"); expect(i18next.t).toHaveBeenCalledWith("modifierType:ModifierType.AddPokeballModifierType.name", expect.objectContaining({ modifierCount: 5 }));
expect(modifierSelectHandler.options[4].modifierTypeOption.type.name).toBe("Rarer Candy"); expect(modifierSelectHandler.options[3].modifierTypeOption.type.name).toBe("modifierType:ModifierType.IV_SCANNER.name");
expect(modifierSelectHandler.options[4].modifierTypeOption.type.name).toBe("modifierType:ModifierType.RARER_CANDY.name");
}); });
it("should leave encounter without battle", async () => { it("should leave encounter without battle", async () => {

View File

@ -213,7 +213,7 @@ describe("Fiery Fallout - Mystery Encounter", () => {
const burnablePokemon = party.filter((pkm) => pkm.isAllowedInBattle() && !pkm.getTypes().includes(Type.FIRE)); const burnablePokemon = party.filter((pkm) => pkm.isAllowedInBattle() && !pkm.getTypes().includes(Type.FIRE));
const notBurnablePokemon = party.filter((pkm) => !pkm.isAllowedInBattle() || pkm.getTypes().includes(Type.FIRE)); const notBurnablePokemon = party.filter((pkm) => !pkm.isAllowedInBattle() || pkm.getTypes().includes(Type.FIRE));
expect(scene.currentBattle.mysteryEncounter?.dialogueTokens["burnedPokemon"]).toBe("Gengar"); expect(scene.currentBattle.mysteryEncounter?.dialogueTokens["burnedPokemon"]).toBe("pokemon:gengar");
burnablePokemon.forEach((pkm) => { burnablePokemon.forEach((pkm) => {
expect(pkm.hp, `${pkm.name} should have received 20% damage: ${pkm.hp} / ${pkm.getMaxHp()} HP`).toBe(pkm.getMaxHp() - Math.floor(pkm.getMaxHp() * 0.2)); expect(pkm.hp, `${pkm.name} should have received 20% damage: ${pkm.hp} / ${pkm.getMaxHp()} HP`).toBe(pkm.getMaxHp() - Math.floor(pkm.getMaxHp() * 0.2));
}); });

View File

@ -102,8 +102,8 @@ describe("Lost at Sea - Mystery Encounter", () => {
const onInitResult = onInit!(scene); const onInitResult = onInit!(scene);
expect(LostAtSeaEncounter.dialogueTokens?.damagePercentage).toBe("25"); expect(LostAtSeaEncounter.dialogueTokens?.damagePercentage).toBe("25");
expect(LostAtSeaEncounter.dialogueTokens?.option1RequiredMove).toBe("Surf"); expect(LostAtSeaEncounter.dialogueTokens?.option1RequiredMove).toBe("move:surf.name");
expect(LostAtSeaEncounter.dialogueTokens?.option2RequiredMove).toBe("Fly"); expect(LostAtSeaEncounter.dialogueTokens?.option2RequiredMove).toBe("move:fly.name");
expect(onInitResult).toBe(true); expect(onInitResult).toBe(true);
}); });

View File

@ -294,8 +294,8 @@ describe("Teleporting Hijinks - Mystery Encounter", () => {
expect(scene.ui.getMode()).to.equal(Mode.MODIFIER_SELECT); expect(scene.ui.getMode()).to.equal(Mode.MODIFIER_SELECT);
const modifierSelectHandler = scene.ui.handlers.find(h => h instanceof ModifierSelectUiHandler) as ModifierSelectUiHandler; const modifierSelectHandler = scene.ui.handlers.find(h => h instanceof ModifierSelectUiHandler) as ModifierSelectUiHandler;
expect(modifierSelectHandler.options.some(opt => opt.modifierTypeOption.type.name === "Metal Coat")).toBe(true); expect(modifierSelectHandler.options.some(opt => opt.modifierTypeOption.type.name === "modifierType:AttackTypeBoosterItem.metal_coat")).toBe(true);
expect(modifierSelectHandler.options.some(opt => opt.modifierTypeOption.type.name === "Magnet")).toBe(true); expect(modifierSelectHandler.options.some(opt => opt.modifierTypeOption.type.name === "modifierType:AttackTypeBoosterItem.magnet")).toBe(true);
}); });
}); });
}); });

View File

@ -254,7 +254,7 @@ describe("Mystery Encounter Utils", () => {
scene.currentBattle.mysteryEncounter.setDialogueToken("test", "value"); scene.currentBattle.mysteryEncounter.setDialogueToken("test", "value");
const result = getEncounterText(scene, "mysteryEncounter:unit_test_dialogue"); const result = getEncounterText(scene, "mysteryEncounter:unit_test_dialogue");
expect(result).toEqual("valuevalue {{testvalue}} {{test1}} {{test}} {{test\\}} {{test\\}} {test}}"); expect(result).toEqual("mysteryEncounter:unit_test_dialogue");
}); });
it("can perform nested dialogue token injection", () => { it("can perform nested dialogue token injection", () => {
@ -263,7 +263,7 @@ describe("Mystery Encounter Utils", () => {
scene.currentBattle.mysteryEncounter.setDialogueToken("testvalue", "new"); scene.currentBattle.mysteryEncounter.setDialogueToken("testvalue", "new");
const result = getEncounterText(scene, "mysteryEncounter:unit_test_dialogue"); const result = getEncounterText(scene, "mysteryEncounter:unit_test_dialogue");
expect(result).toEqual("valuevalue {{testvalue}} {{test1}} {{test}} {{test\\}} {{test\\}} {test}}"); expect(result).toEqual("mysteryEncounter:unit_test_dialogue");
}); });
}); });
@ -275,7 +275,7 @@ describe("Mystery Encounter Utils", () => {
const phaseSpy = vi.spyOn(game.scene, "unshiftPhase"); const phaseSpy = vi.spyOn(game.scene, "unshiftPhase");
queueEncounterMessage(scene, "mysteryEncounter:unit_test_dialogue"); queueEncounterMessage(scene, "mysteryEncounter:unit_test_dialogue");
expect(spy).toHaveBeenCalledWith("valuevalue {{testvalue}} {{test1}} {{test}} {{test\\}} {{test\\}} {test}}", null, true); expect(spy).toHaveBeenCalledWith("mysteryEncounter:unit_test_dialogue", null, true);
expect(phaseSpy).toHaveBeenCalledWith(expect.any(MessagePhase)); expect(phaseSpy).toHaveBeenCalledWith(expect.any(MessagePhase));
}); });
}); });
@ -287,7 +287,7 @@ describe("Mystery Encounter Utils", () => {
const spy = vi.spyOn(game.scene.ui, "showText"); const spy = vi.spyOn(game.scene.ui, "showText");
await showEncounterText(scene, "mysteryEncounter:unit_test_dialogue"); await showEncounterText(scene, "mysteryEncounter:unit_test_dialogue");
expect(spy).toHaveBeenCalledWith("valuevalue {{testvalue}} {{test1}} {{test}} {{test\\}} {{test\\}} {test}}", null, expect.any(Function), 0, true, null); expect(spy).toHaveBeenCalledWith("mysteryEncounter:unit_test_dialogue", null, expect.any(Function), 0, true, null);
}); });
}); });
@ -298,7 +298,7 @@ describe("Mystery Encounter Utils", () => {
const spy = vi.spyOn(game.scene.ui, "showDialogue"); const spy = vi.spyOn(game.scene.ui, "showDialogue");
await showEncounterDialogue(scene, "mysteryEncounter:unit_test_dialogue", "mysteryEncounter:unit_test_dialogue"); await showEncounterDialogue(scene, "mysteryEncounter:unit_test_dialogue", "mysteryEncounter:unit_test_dialogue");
expect(spy).toHaveBeenCalledWith("valuevalue {{testvalue}} {{test1}} {{test}} {{test\\}} {{test\\}} {test}}", "valuevalue {{testvalue}} {{test1}} {{test}} {{test\\}} {{test\\}} {test}}", null, expect.any(Function), 0); expect(spy).toHaveBeenCalledWith("mysteryEncounter:unit_test_dialogue", "mysteryEncounter:unit_test_dialogue", null, expect.any(Function), 0);
}); });
}); });

View File

@ -56,8 +56,9 @@ describe("Mystery Encounter Phases", () => {
}); });
it("Selects an option for MysteryEncounterPhase", async() => { it("Selects an option for MysteryEncounterPhase", async() => {
const dialogueSpy = vi.spyOn(game.scene.ui, "showDialogue"); const { ui } = game.scene;
const messageSpy = vi.spyOn(game.scene.ui, "showText"); vi.spyOn(ui, "showDialogue");
vi.spyOn(ui, "showText");
await game.runToMysteryEncounter(MysteryEncounterType.MYSTERIOUS_CHALLENGERS, [Species.CHARIZARD, Species.VOLCARONA]); await game.runToMysteryEncounter(MysteryEncounterType.MYSTERIOUS_CHALLENGERS, [Species.CHARIZARD, Species.VOLCARONA]);
game.onNextPrompt("MysteryEncounterPhase", Mode.MESSAGE, () => { game.onNextPrompt("MysteryEncounterPhase", Mode.MESSAGE, () => {
@ -74,12 +75,12 @@ describe("Mystery Encounter Phases", () => {
// Waitfor required so that option select messages and preOptionPhase logic are handled // Waitfor required so that option select messages and preOptionPhase logic are handled
await vi.waitFor(() => expect(game.scene.getCurrentPhase()?.constructor.name).toBe(MysteryEncounterOptionSelectedPhase.name)); await vi.waitFor(() => expect(game.scene.getCurrentPhase()?.constructor.name).toBe(MysteryEncounterOptionSelectedPhase.name));
expect(game.scene.ui.getMode()).toBe(Mode.MESSAGE); expect(ui.getMode()).toBe(Mode.MESSAGE);
expect(dialogueSpy).toHaveBeenCalledTimes(1); expect(ui.showDialogue).toHaveBeenCalledTimes(1);
expect(messageSpy).toHaveBeenCalledTimes(2); expect(ui.showText).toHaveBeenCalledTimes(2);
expect(dialogueSpy).toHaveBeenCalledWith("What's this?", "???", null, expect.any(Function)); expect(ui.showDialogue).toHaveBeenCalledWith("battle:mysteryEncounterAppeared", "???", null, expect.any(Function));
expect(messageSpy).toHaveBeenCalledWith("Mysterious challengers have appeared!", null, expect.any(Function), 750, true); expect(ui.showText).toHaveBeenCalledWith("mysteryEncounter:mysteriousChallengers.intro", null, expect.any(Function), 750, true);
expect(messageSpy).toHaveBeenCalledWith("The trainer steps forward...", null, expect.any(Function), 300, true); expect(ui.showText).toHaveBeenCalledWith("mysteryEncounter:mysteriousChallengers.option.selected", null, expect.any(Function), 300, true);
}); });
}); });

View File

@ -66,11 +66,11 @@ describe("UI - Starter select", () => {
resolve(); resolve();
}); });
}); });
expect(options.some(option => option.label === "Add to Party")).toBe(true); expect(options.some(option => option.label === "starterSelectUiHandler:addToParty")).toBe(true);
expect(options.some(option => option.label === "Toggle IVs")).toBe(true); expect(options.some(option => option.label === "starterSelectUiHandler:toggleIVs")).toBe(true);
expect(options.some(option => option.label === "Manage Moves")).toBe(true); expect(options.some(option => option.label === "starterSelectUiHandler:manageMoves")).toBe(true);
expect(options.some(option => option.label === "Use Candies")).toBe(true); expect(options.some(option => option.label === "starterSelectUiHandler:useCandies")).toBe(true);
expect(options.some(option => option.label === "Cancel")).toBe(true); expect(options.some(option => option.label === "menu:cancel")).toBe(true);
optionSelectUiHandler?.processInput(Button.ACTION); optionSelectUiHandler?.processInput(Button.ACTION);
await new Promise<void>((resolve) => { await new Promise<void>((resolve) => {
@ -127,11 +127,11 @@ describe("UI - Starter select", () => {
resolve(); resolve();
}); });
}); });
expect(options.some(option => option.label === "Add to Party")).toBe(true); expect(options.some(option => option.label === "starterSelectUiHandler:addToParty")).toBe(true);
expect(options.some(option => option.label === "Toggle IVs")).toBe(true); expect(options.some(option => option.label === "starterSelectUiHandler:toggleIVs")).toBe(true);
expect(options.some(option => option.label === "Manage Moves")).toBe(true); expect(options.some(option => option.label === "starterSelectUiHandler:manageMoves")).toBe(true);
expect(options.some(option => option.label === "Use Candies")).toBe(true); expect(options.some(option => option.label === "starterSelectUiHandler:useCandies")).toBe(true);
expect(options.some(option => option.label === "Cancel")).toBe(true); expect(options.some(option => option.label === "menu:cancel")).toBe(true);
optionSelectUiHandler?.processInput(Button.ACTION); optionSelectUiHandler?.processInput(Button.ACTION);
await new Promise<void>((resolve) => { await new Promise<void>((resolve) => {
@ -191,11 +191,11 @@ describe("UI - Starter select", () => {
resolve(); resolve();
}); });
}); });
expect(options.some(option => option.label === "Add to Party")).toBe(true); expect(options.some(option => option.label === "starterSelectUiHandler:addToParty")).toBe(true);
expect(options.some(option => option.label === "Toggle IVs")).toBe(true); expect(options.some(option => option.label === "starterSelectUiHandler:toggleIVs")).toBe(true);
expect(options.some(option => option.label === "Manage Moves")).toBe(true); expect(options.some(option => option.label === "starterSelectUiHandler:manageMoves")).toBe(true);
expect(options.some(option => option.label === "Use Candies")).toBe(true); expect(options.some(option => option.label === "starterSelectUiHandler:useCandies")).toBe(true);
expect(options.some(option => option.label === "Cancel")).toBe(true); expect(options.some(option => option.label === "menu:cancel")).toBe(true);
optionSelectUiHandler?.processInput(Button.ACTION); optionSelectUiHandler?.processInput(Button.ACTION);
await new Promise<void>((resolve) => { await new Promise<void>((resolve) => {
@ -254,11 +254,11 @@ describe("UI - Starter select", () => {
resolve(); resolve();
}); });
}); });
expect(options.some(option => option.label === "Add to Party")).toBe(true); expect(options.some(option => option.label === "starterSelectUiHandler:addToParty")).toBe(true);
expect(options.some(option => option.label === "Toggle IVs")).toBe(true); expect(options.some(option => option.label === "starterSelectUiHandler:toggleIVs")).toBe(true);
expect(options.some(option => option.label === "Manage Moves")).toBe(true); expect(options.some(option => option.label === "starterSelectUiHandler:manageMoves")).toBe(true);
expect(options.some(option => option.label === "Use Candies")).toBe(true); expect(options.some(option => option.label === "starterSelectUiHandler:useCandies")).toBe(true);
expect(options.some(option => option.label === "Cancel")).toBe(true); expect(options.some(option => option.label === "menu:cancel")).toBe(true);
optionSelectUiHandler?.processInput(Button.ACTION); optionSelectUiHandler?.processInput(Button.ACTION);
await new Promise<void>((resolve) => { await new Promise<void>((resolve) => {
@ -315,11 +315,11 @@ describe("UI - Starter select", () => {
resolve(); resolve();
}); });
}); });
expect(options.some(option => option.label === "Add to Party")).toBe(true); expect(options.some(option => option.label === "starterSelectUiHandler:addToParty")).toBe(true);
expect(options.some(option => option.label === "Toggle IVs")).toBe(true); expect(options.some(option => option.label === "starterSelectUiHandler:toggleIVs")).toBe(true);
expect(options.some(option => option.label === "Manage Moves")).toBe(true); expect(options.some(option => option.label === "starterSelectUiHandler:manageMoves")).toBe(true);
expect(options.some(option => option.label === "Use Candies")).toBe(true); expect(options.some(option => option.label === "starterSelectUiHandler:useCandies")).toBe(true);
expect(options.some(option => option.label === "Cancel")).toBe(true); expect(options.some(option => option.label === "menu:cancel")).toBe(true);
optionSelectUiHandler?.processInput(Button.ACTION); optionSelectUiHandler?.processInput(Button.ACTION);
await new Promise<void>((resolve) => { await new Promise<void>((resolve) => {
@ -376,11 +376,11 @@ describe("UI - Starter select", () => {
resolve(); resolve();
}); });
}); });
expect(options.some(option => option.label === "Add to Party")).toBe(true); expect(options.some(option => option.label === "starterSelectUiHandler:addToParty")).toBe(true);
expect(options.some(option => option.label === "Toggle IVs")).toBe(true); expect(options.some(option => option.label === "starterSelectUiHandler:toggleIVs")).toBe(true);
expect(options.some(option => option.label === "Manage Moves")).toBe(true); expect(options.some(option => option.label === "starterSelectUiHandler:manageMoves")).toBe(true);
expect(options.some(option => option.label === "Use Candies")).toBe(true); expect(options.some(option => option.label === "starterSelectUiHandler:useCandies")).toBe(true);
expect(options.some(option => option.label === "Cancel")).toBe(true); expect(options.some(option => option.label === "menu:cancel")).toBe(true);
optionSelectUiHandler?.processInput(Button.ACTION); optionSelectUiHandler?.processInput(Button.ACTION);
await new Promise<void>((resolve) => { await new Promise<void>((resolve) => {
@ -436,11 +436,11 @@ describe("UI - Starter select", () => {
resolve(); resolve();
}); });
}); });
expect(options.some(option => option.label === "Add to Party")).toBe(true); expect(options.some(option => option.label === "starterSelectUiHandler:addToParty")).toBe(true);
expect(options.some(option => option.label === "Toggle IVs")).toBe(true); expect(options.some(option => option.label === "starterSelectUiHandler:toggleIVs")).toBe(true);
expect(options.some(option => option.label === "Manage Moves")).toBe(true); expect(options.some(option => option.label === "starterSelectUiHandler:manageMoves")).toBe(true);
expect(options.some(option => option.label === "Use Candies")).toBe(true); expect(options.some(option => option.label === "starterSelectUiHandler:useCandies")).toBe(true);
expect(options.some(option => option.label === "Cancel")).toBe(true); expect(options.some(option => option.label === "menu:cancel")).toBe(true);
optionSelectUiHandler?.processInput(Button.ACTION); optionSelectUiHandler?.processInput(Button.ACTION);
await new Promise<void>((resolve) => { await new Promise<void>((resolve) => {
@ -496,11 +496,11 @@ describe("UI - Starter select", () => {
resolve(); resolve();
}); });
}); });
expect(options.some(option => option.label === "Add to Party")).toBe(true); expect(options.some(option => option.label === "starterSelectUiHandler:addToParty")).toBe(true);
expect(options.some(option => option.label === "Toggle IVs")).toBe(true); expect(options.some(option => option.label === "starterSelectUiHandler:toggleIVs")).toBe(true);
expect(options.some(option => option.label === "Manage Moves")).toBe(true); expect(options.some(option => option.label === "starterSelectUiHandler:manageMoves")).toBe(true);
expect(options.some(option => option.label === "Use Candies")).toBe(true); expect(options.some(option => option.label === "starterSelectUiHandler:useCandies")).toBe(true);
expect(options.some(option => option.label === "Cancel")).toBe(true); expect(options.some(option => option.label === "menu:cancel")).toBe(true);
optionSelectUiHandler?.processInput(Button.ACTION); optionSelectUiHandler?.processInput(Button.ACTION);
let starterSelectUiHandler: StarterSelectUiHandler; let starterSelectUiHandler: StarterSelectUiHandler;
@ -561,11 +561,11 @@ describe("UI - Starter select", () => {
resolve(); resolve();
}); });
}); });
expect(options.some(option => option.label === "Add to Party")).toBe(true); expect(options.some(option => option.label === "starterSelectUiHandler:addToParty")).toBe(true);
expect(options.some(option => option.label === "Toggle IVs")).toBe(true); expect(options.some(option => option.label === "starterSelectUiHandler:toggleIVs")).toBe(true);
expect(options.some(option => option.label === "Manage Moves")).toBe(true); expect(options.some(option => option.label === "starterSelectUiHandler:manageMoves")).toBe(true);
expect(options.some(option => option.label === "Use Candies")).toBe(true); expect(options.some(option => option.label === "starterSelectUiHandler:useCandies")).toBe(true);
expect(options.some(option => option.label === "Cancel")).toBe(true); expect(options.some(option => option.label === "menu:cancel")).toBe(true);
optionSelectUiHandler?.processInput(Button.ACTION); optionSelectUiHandler?.processInput(Button.ACTION);
let starterSelectUiHandler: StarterSelectUiHandler | undefined; let starterSelectUiHandler: StarterSelectUiHandler | undefined;

View File

@ -53,7 +53,7 @@ describe("UI - Type Hints", () => {
const movesContainer = ui.getByName<Phaser.GameObjects.Container>(FightUiHandler.MOVES_CONTAINER_NAME); const movesContainer = ui.getByName<Phaser.GameObjects.Container>(FightUiHandler.MOVES_CONTAINER_NAME);
const dragonClawText = movesContainer const dragonClawText = movesContainer
.getAll<Phaser.GameObjects.Text>() .getAll<Phaser.GameObjects.Text>()
.find((text) => text.text === "Dragon Claw")! as unknown as MockText; .find((text) => text.text === "move:dragonClaw.name")! as unknown as MockText;
expect.soft(dragonClawText.color).toBe("#929292"); expect.soft(dragonClawText.color).toBe("#929292");
ui.getHandler().processInput(Button.ACTION); ui.getHandler().processInput(Button.ACTION);
@ -78,7 +78,7 @@ describe("UI - Type Hints", () => {
const movesContainer = ui.getByName<Phaser.GameObjects.Container>(FightUiHandler.MOVES_CONTAINER_NAME); const movesContainer = ui.getByName<Phaser.GameObjects.Container>(FightUiHandler.MOVES_CONTAINER_NAME);
const growlText = movesContainer const growlText = movesContainer
.getAll<Phaser.GameObjects.Text>() .getAll<Phaser.GameObjects.Text>()
.find((text) => text.text === "Growl")! as unknown as MockText; .find((text) => text.text === "move:growl.name")! as unknown as MockText;
expect.soft(growlText.color).toBe(undefined); expect.soft(growlText.color).toBe(undefined);
ui.getHandler().processInput(Button.ACTION); ui.getHandler().processInput(Button.ACTION);