fix tests (splashj)

This commit is contained in:
flx-sta 2024-09-18 17:52:05 -07:00
parent 8dc228125b
commit cb09606711
3 changed files with 14 additions and 5 deletions

View File

@ -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;

View File

@ -1,3 +1,5 @@
import { USE_SEASONAL_SPLASH_MESSAGES } from "#app/constants";
//#region Interfaces/Types //#region Interfaces/Types
type Month = "01" | "02" | "03" | "04" | "05" | "06" | "07" | "08" | "09" | "10" | "11" | "12"; type Month = "01" | "02" | "03" | "04" | "05" | "06" | "07" | "08" | "09" | "10" | "11" | "12";
@ -41,8 +43,6 @@ interface Season {
//#region Constants //#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 */ /** The weight multiplier for the battles-won splash message */
const BATTLES_WON_WEIGHT_MULTIPLIER = 10; const BATTLES_WON_WEIGHT_MULTIPLIER = 10;
/** The weight multiplier for the seasonal splash messages */ /** The weight multiplier for the seasonal splash messages */
@ -114,7 +114,7 @@ const seasonalSplashMessages: Season[] = [
export function getSplashMessages(): string[] { export function getSplashMessages(): string[] {
const splashMessages: string[] = [...commonSplashMessages]; const splashMessages: string[] = [...commonSplashMessages];
console.log("use seasonal splash messages", USE_SEASONAL_SPLASH_MESSAGES);
if (USE_SEASONAL_SPLASH_MESSAGES) { if (USE_SEASONAL_SPLASH_MESSAGES) {
// add seasonal splash messages if the season is active // add seasonal splash messages if the season is active
for (const { name, start, end, messages } of seasonalSplashMessages) { for (const { name, start, end, messages } of seasonalSplashMessages) {

View File

@ -1,5 +1,6 @@
import { getSplashMessages } from "#app/data/splash-messages"; 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", () => { describe("Data - Splash Messages", () => {
it("should contain at least 15 splash messages", () => { it("should contain at least 15 splash messages", () => {
@ -13,6 +14,10 @@ describe("Data - Splash Messages", () => {
}); });
describe("Seasonal", () => { describe("Seasonal", () => {
beforeEach(() => {
vi.spyOn(Constants, "USE_SEASONAL_SPLASH_MESSAGES", "get").mockReturnValue(true);
});
afterEach(() => { afterEach(() => {
vi.useRealTimers(); // reset system time vi.useRealTimers(); // reset system time
}); });