From af989fdaa6989c577511eb562c88fe7fb11c5ab6 Mon Sep 17 00:00:00 2001 From: Felix Staud Date: Tue, 16 Jul 2024 15:17:26 -0700 Subject: [PATCH] add `testUtils.workaround_reInitSceneWithOverrides()` --- src/test/utils/testUtils.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/test/utils/testUtils.ts b/src/test/utils/testUtils.ts index b922fc9c61c..a8461b3a5db 100644 --- a/src/test/utils/testUtils.ts +++ b/src/test/utils/testUtils.ts @@ -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); +}