test: use vi.spyOn to mock console.debug

This commit is contained in:
FloPinguin
2026-06-18 22:17:51 +02:00
parent d954e357b2
commit 286e180215
+5 -1
View File
@@ -63,7 +63,7 @@ function buildTerrain(
}
async function setupImpassableGame(humans: PlayerInfo[] = []): Promise<Game> {
console.debug = () => {};
vi.spyOn(console, "debug").mockImplementation(() => {});
const full = buildTerrain(MAP_W, MAP_H, WALL_X, WALL_WIDTH);
const mini = buildTerrain(MINI_W, MINI_H, Math.floor(WALL_X / 2), 1);
@@ -104,6 +104,10 @@ describe("Impassable Terrain", () => {
let player: Player;
let other: Player;
afterEach(() => {
vi.restoreAllMocks();
});
beforeEach(async () => {
game = await setupImpassableGame([
new PlayerInfo("player", PlayerType.Human, "c1", "player_id"),