mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-21 11:10:42 +00:00
test: use vi.spyOn to mock console.debug
This commit is contained in:
@@ -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"),
|
||||
|
||||
Reference in New Issue
Block a user