tests: add mock for FontFace and it to vitest setup (#1591)

This commit is contained in:
flx-sta 2024-05-29 20:44:36 -07:00 committed by GitHub
parent 6c5e7884df
commit 48f2ecf39a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 18 additions and 0 deletions

View File

@ -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<FontFaceMock> {
return Promise.resolve(this);
}
}
globalThis.FontFace = FontFaceMock as any;

View File

@ -1,5 +1,6 @@
import "vitest-canvas-mock"; import "vitest-canvas-mock";
import "#app/test/phaser.setup"; import "#app/test/phaser.setup";
import "#app/test/fontFace.setup";
import {initStatsKeys} from "#app/ui/game-stats-ui-handler"; import {initStatsKeys} from "#app/ui/game-stats-ui-handler";
import {initPokemonPrevolutions} from "#app/data/pokemon-evolutions"; import {initPokemonPrevolutions} from "#app/data/pokemon-evolutions";
import {initBiomes} from "#app/data/biomes"; import {initBiomes} from "#app/data/biomes";