From e237f87a1ecb7daa506f8800ffdff39b8f25db56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Garapich?= Date: Fri, 2 Aug 2024 11:30:06 +0000 Subject: [PATCH] test(e2e): async GameServerSimulator run() and close() --- tests/fixtures/simulate-game-server.ts | 4 ++-- tests/game-server-simulator.ts | 12 ++++++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/tests/fixtures/simulate-game-server.ts b/tests/fixtures/simulate-game-server.ts index 2c6eeb4a..3736f1cc 100644 --- a/tests/fixtures/simulate-game-server.ts +++ b/tests/fixtures/simulate-game-server.ts @@ -11,10 +11,10 @@ export const simulateGameServer = test.extend<{ gameServer: GameServerSimulator } const gameServer = new GameServerSimulator(apiAddress, secret) - gameServer.run() + await gameServer.run() await gameServer.sendHeartbeat() await use(gameServer) - gameServer.close() + await gameServer.close() }, }) diff --git a/tests/game-server-simulator.ts b/tests/game-server-simulator.ts index d33473e3..755c6b27 100644 --- a/tests/game-server-simulator.ts +++ b/tests/game-server-simulator.ts @@ -188,12 +188,16 @@ export class GameServerSimulator { return cvar } - run() { - this.server.listen(27015) + async run() { + return new Promise(resolve => { + this.server.listen(27015, resolve) + }) } - close() { - this.socket.close() + async close() { + return new Promise(resolve => { + this.socket.close(resolve) + }) } log(message: string) {