Skip to content

Commit

Permalink
test(e2e): async GameServerSimulator run() and close()
Browse files Browse the repository at this point in the history
  • Loading branch information
garrappachc committed Aug 2, 2024
1 parent 27a21c4 commit e237f87
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
4 changes: 2 additions & 2 deletions tests/fixtures/simulate-game-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
},
})

Expand Down
12 changes: 8 additions & 4 deletions tests/game-server-simulator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,12 +188,16 @@ export class GameServerSimulator {
return cvar
}

run() {
this.server.listen(27015)
async run() {
return new Promise<void>(resolve => {
this.server.listen(27015, resolve)
})
}

close() {
this.socket.close()
async close() {
return new Promise<void>(resolve => {
this.socket.close(resolve)
})
}

log(message: string) {
Expand Down

0 comments on commit e237f87

Please sign in to comment.