add `testUtils.workaround_reInitSceneWithOverrides()`

This commit is contained in:
Felix Staud 2024-07-16 15:17:26 -07:00
parent cb4162252c
commit af989fdaa6
1 changed files with 13 additions and 0 deletions

View File

@ -1,5 +1,6 @@
import i18next, { type ParseKeys } from "i18next";
import { vi } from "vitest";
import GameManager from "./gameManager";
/**
* Sets up the i18next mock.
@ -21,3 +22,15 @@ export function mockI18next() {
export function arrayOfRange(start: integer, end: integer) {
return Array.from({ length: end - start }, (_v, k) => k + start);
}
/**
* Woraround to reinitialize the game scene with overrides being set properly.
* By default the scene is initialized without all overrides even having a chance to be applied.
* @warning USE AT YOUR OWN RISK! Might be deleted in the future
* @param game The game manager
* @deprecated
*/
export async function workaround_reInitSceneWithOverrides(game: GameManager) {
await game.runToTitle();
game.gameWrapper.setScene(game.scene);
}