From 65bb58a635c5e32eb852f5ab2db438e97b0ef907 Mon Sep 17 00:00:00 2001 From: Bertie690 <136088738+Bertie690@users.noreply.github.com> Date: Mon, 15 Sep 2025 16:51:28 -0400 Subject: [PATCH 1/3] [Dev] Fix + rename `test:create` boilerplate file (#6560) * Rename `default.ts` to `default.boilerplate.ts` * Update `test:create` script to look in the correct location * Update `biome.jsonc` to remove explicit boilerplate folder check * Apply Biome --- biome.jsonc | 11 ++--------- .../{default.ts => default.boilerplate.ts} | 2 +- scripts/create-test/create-test.js | 4 ++-- 3 files changed, 5 insertions(+), 12 deletions(-) rename scripts/create-test/boilerplates/{default.ts => default.boilerplate.ts} (94%) diff --git a/biome.jsonc b/biome.jsonc index 9e87518e636..2433ba52010 100644 --- a/biome.jsonc +++ b/biome.jsonc @@ -254,16 +254,9 @@ }, // Overrides to prevent unused import removal inside `overrides.ts`, enums & `.d.ts` files (for TSDoc linkcodes), - // as well as inside script boilerplate files. + // as well as inside script boilerplate files (whose imports will _presumably_ be used in the generated file). { - // TODO: Rename existing boilerplates in the folder and remove this last alias - "includes": [ - "**/src/overrides.ts", - "**/src/enums/**/*", - "**/*.d.ts", - "scripts/**/*.boilerplate.ts", - "**/boilerplates/*.ts" - ], + "includes": ["**/src/overrides.ts", "**/src/enums/**/*", "**/*.d.ts", "scripts/**/*.boilerplate.ts"], "linter": { "rules": { "correctness": { diff --git a/scripts/create-test/boilerplates/default.ts b/scripts/create-test/boilerplates/default.boilerplate.ts similarity index 94% rename from scripts/create-test/boilerplates/default.ts rename to scripts/create-test/boilerplates/default.boilerplate.ts index e644e740594..7b633cf8276 100644 --- a/scripts/create-test/boilerplates/default.ts +++ b/scripts/create-test/boilerplates/default.boilerplate.ts @@ -47,6 +47,6 @@ describe("{{description}}", () => { await game.toEndOfTurn(); expect(feebas).toHaveUsedMove({ move: MoveId.SPLASH, result: MoveResult.SUCCESS }); - expect(game.textInterceptor.logs).toContain(i18next.t("moveTriggers:splash")); + expect(game).toHaveShownMessage(i18next.t("moveTriggers:splash")); }); }); diff --git a/scripts/create-test/create-test.js b/scripts/create-test/create-test.js index 5e395783da7..df065657346 100644 --- a/scripts/create-test/create-test.js +++ b/scripts/create-test/create-test.js @@ -102,9 +102,9 @@ async function promptFileName(selectedType) { function getBoilerplatePath(choiceType) { switch (choiceType) { // case "Reward": - // return path.join(__dirname, "boilerplates/reward.ts"); + // return path.join(__dirname, "boilerplates/reward.boilerplate.ts"); default: - return path.join(__dirname, "boilerplates/default.ts"); + return path.join(__dirname, "boilerplates/default.boilerplate.ts"); } } From 6ce59ecbd983bccbf24ca3c7f4c2cbf42d78a41d Mon Sep 17 00:00:00 2001 From: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com> Date: Mon, 15 Sep 2025 19:49:18 -0500 Subject: [PATCH 2/3] [Bug] Cookies being fetched improperly --- src/utils/cookies.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils/cookies.ts b/src/utils/cookies.ts index e82895d1fac..49c47437241 100644 --- a/src/utils/cookies.ts +++ b/src/utils/cookies.ts @@ -25,9 +25,9 @@ export function getCookie(cName: string): string { const ca = document.cookie.split(";"); // Check all cookies in the document and see if any of them match, grabbing the first one whose value lines up for (const c of ca) { - const cTrimmed = c.trim(); + const cTrimmed = c.trimStart(); if (cTrimmed.startsWith(name)) { - return c.slice(name.length, c.length); + return c.substring(name.length, c.length); } } return ""; From 85c38dfdbe1a6cf6aa26862ec7952ab76f2d7ab0 Mon Sep 17 00:00:00 2001 From: Sirz Benjie <142067137+SirzBenjie@users.noreply.github.com> Date: Mon, 15 Sep 2025 19:55:45 -0500 Subject: [PATCH 3/3] [Bug] Cookies being fetched improperly v2 --- src/utils/cookies.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/utils/cookies.ts b/src/utils/cookies.ts index 49c47437241..e16d9d78556 100644 --- a/src/utils/cookies.ts +++ b/src/utils/cookies.ts @@ -23,10 +23,12 @@ export function getCookie(cName: string): string { } const name = `${cName}=`; const ca = document.cookie.split(";"); - // Check all cookies in the document and see if any of them match, grabbing the first one whose value lines up - for (const c of ca) { - const cTrimmed = c.trimStart(); - if (cTrimmed.startsWith(name)) { + for (let c of ca) { + // ⚠️ DO NOT REPLACE THIS WITH C = C.TRIM() - IT BREAKS IN NON-CHROMIUM BROWSERS ⚠️ + while (c.charAt(0) === " ") { + c = c.substring(1); + } + if (c.indexOf(name) === 0) { return c.substring(name.length, c.length); } }