mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-26 01:09:29 +02:00
mock i18next for tests
This commit is contained in:
parent
08f2866998
commit
962fa6e0e4
@ -5,13 +5,13 @@ import { initAbilities } from "#app/data/ability";
|
|||||||
import { initBiomes } from "#app/data/biomes";
|
import { initBiomes } from "#app/data/biomes";
|
||||||
import { initEggMoves } from "#app/data/egg-moves";
|
import { initEggMoves } from "#app/data/egg-moves";
|
||||||
import { initMoves } from "#app/data/move";
|
import { initMoves } from "#app/data/move";
|
||||||
|
import { initMysteryEncounters } from "#app/data/mystery-encounters/mystery-encounters";
|
||||||
import { initPokemonPrevolutions } from "#app/data/pokemon-evolutions";
|
import { initPokemonPrevolutions } from "#app/data/pokemon-evolutions";
|
||||||
import { initPokemonForms } from "#app/data/pokemon-forms";
|
import { initPokemonForms } from "#app/data/pokemon-forms";
|
||||||
import { initSpecies } from "#app/data/pokemon-species";
|
import { initSpecies } from "#app/data/pokemon-species";
|
||||||
import { initAchievements } from "#app/system/achv";
|
import { initAchievements } from "#app/system/achv";
|
||||||
import { initVouchers } from "#app/system/voucher";
|
import { initVouchers } from "#app/system/voucher";
|
||||||
import { initStatsKeys } from "#app/ui/game-stats-ui-handler";
|
import { initStatsKeys } from "#app/ui/game-stats-ui-handler";
|
||||||
import { initMysteryEncounters } from "#app/data/mystery-encounters/mystery-encounters";
|
|
||||||
import { beforeAll, vi } from "vitest";
|
import { beforeAll, vi } from "vitest";
|
||||||
|
|
||||||
/** Mock the override import to always return default values, ignoring any custom overrides. */
|
/** Mock the override import to always return default values, ignoring any custom overrides. */
|
||||||
@ -20,10 +20,31 @@ vi.mock("#app/overrides", async (importOriginal) => {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
default: defaultOverrides,
|
default: defaultOverrides,
|
||||||
defaultOverrides
|
defaultOverrides,
|
||||||
} satisfies typeof import("#app/overrides");
|
} satisfies typeof import("#app/overrides");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
vi.mock("i18next", () => ({
|
||||||
|
default: {
|
||||||
|
use: () => {},
|
||||||
|
t: (key: string) => key,
|
||||||
|
changeLanguage: () => Promise.resolve(),
|
||||||
|
init: () => Promise.resolve(),
|
||||||
|
resolvedLanguage: "en",
|
||||||
|
exists: vi.fn(() => true),
|
||||||
|
getDataByLanguage:() => ({
|
||||||
|
en: {
|
||||||
|
keys: ["foo"]
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
services: {
|
||||||
|
formatter: {
|
||||||
|
add: vi.fn(),
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}));
|
||||||
|
|
||||||
initVouchers();
|
initVouchers();
|
||||||
initAchievements();
|
initAchievements();
|
||||||
initStatsKeys();
|
initStatsKeys();
|
||||||
@ -44,6 +65,6 @@ beforeAll(() => {
|
|||||||
writable: true,
|
writable: true,
|
||||||
value: {
|
value: {
|
||||||
add: () => {},
|
add: () => {},
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user