From 48f2ecf39a72c6aeec922ec80e67be917337e990 Mon Sep 17 00:00:00 2001 From: flx-sta <50131232+flx-sta@users.noreply.github.com> Date: Wed, 29 May 2024 20:44:36 -0700 Subject: [PATCH] tests: add mock for FontFace and it to vitest setup (#1591) --- src/test/fontFace.setup.ts | 17 +++++++++++++++++ src/test/vitest.setup.ts | 1 + 2 files changed, 18 insertions(+) create mode 100644 src/test/fontFace.setup.ts diff --git a/src/test/fontFace.setup.ts b/src/test/fontFace.setup.ts new file mode 100644 index 00000000000..d9d74c5f774 --- /dev/null +++ b/src/test/fontFace.setup.ts @@ -0,0 +1,17 @@ +class FontFaceMock { + family: string; + source: string; + descriptors: any; + + constructor(family: string, source: string, descriptors?: any) { + this.family = family; + this.source = source; + this.descriptors = descriptors; + } + + load(): Promise { + return Promise.resolve(this); + } +} + +globalThis.FontFace = FontFaceMock as any; diff --git a/src/test/vitest.setup.ts b/src/test/vitest.setup.ts index f17a16caf14..5777cc00611 100644 --- a/src/test/vitest.setup.ts +++ b/src/test/vitest.setup.ts @@ -1,5 +1,6 @@ import "vitest-canvas-mock"; import "#app/test/phaser.setup"; +import "#app/test/fontFace.setup"; import {initStatsKeys} from "#app/ui/game-stats-ui-handler"; import {initPokemonPrevolutions} from "#app/data/pokemon-evolutions"; import {initBiomes} from "#app/data/biomes";