From cb0960671133daba4dc22d105e6dd549cbd0a920 Mon Sep 17 00:00:00 2001 From: flx-sta <50131232+flx-sta@users.noreply.github.com> Date: Wed, 18 Sep 2024 17:52:05 -0700 Subject: [PATCH] fix tests (splashj) --- src/constants.ts | 6 +++++- src/data/splash-messages.ts | 6 +++--- src/test/data/splash_messages.test.ts | 7 ++++++- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/constants.ts b/src/constants.ts index a2f7e47b996..0b1261ad814 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -1 +1,5 @@ -export const PLAYER_PARTY_MAX_SIZE = 6; +/** The maximum size of the player's party */ +export const PLAYER_PARTY_MAX_SIZE: number = 6; + +/** Whether to use seasonal splash messages in general */ +export const USE_SEASONAL_SPLASH_MESSAGES: boolean = false; diff --git a/src/data/splash-messages.ts b/src/data/splash-messages.ts index 3e6f3643dae..b8069f77737 100644 --- a/src/data/splash-messages.ts +++ b/src/data/splash-messages.ts @@ -1,3 +1,5 @@ +import { USE_SEASONAL_SPLASH_MESSAGES } from "#app/constants"; + //#region Interfaces/Types type Month = "01" | "02" | "03" | "04" | "05" | "06" | "07" | "08" | "09" | "10" | "11" | "12"; @@ -41,8 +43,6 @@ interface Season { //#region Constants -/** Whether to use seasonal splash messages in general */ -const USE_SEASONAL_SPLASH_MESSAGES = false; /** The weight multiplier for the battles-won splash message */ const BATTLES_WON_WEIGHT_MULTIPLIER = 10; /** The weight multiplier for the seasonal splash messages */ @@ -114,7 +114,7 @@ const seasonalSplashMessages: Season[] = [ export function getSplashMessages(): string[] { const splashMessages: string[] = [...commonSplashMessages]; - + console.log("use seasonal splash messages", USE_SEASONAL_SPLASH_MESSAGES); if (USE_SEASONAL_SPLASH_MESSAGES) { // add seasonal splash messages if the season is active for (const { name, start, end, messages } of seasonalSplashMessages) { diff --git a/src/test/data/splash_messages.test.ts b/src/test/data/splash_messages.test.ts index a638a481472..7e07b9a6e77 100644 --- a/src/test/data/splash_messages.test.ts +++ b/src/test/data/splash_messages.test.ts @@ -1,5 +1,6 @@ import { getSplashMessages } from "#app/data/splash-messages"; -import { describe, expect, it, vi, afterEach } from "vitest"; +import { describe, expect, it, vi, afterEach, beforeEach } from "vitest"; +import * as Constants from "#app/constants"; describe("Data - Splash Messages", () => { it("should contain at least 15 splash messages", () => { @@ -13,6 +14,10 @@ describe("Data - Splash Messages", () => { }); describe("Seasonal", () => { + beforeEach(() => { + vi.spyOn(Constants, "USE_SEASONAL_SPLASH_MESSAGES", "get").mockReturnValue(true); + }); + afterEach(() => { vi.useRealTimers(); // reset system time });