Skip to content

Commit

Permalink
refactor: always wait for hello message in withSocket test helper
Browse files Browse the repository at this point in the history
  • Loading branch information
EagleoutIce committed Aug 30, 2023
1 parent cff0b88 commit 4179305
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
1 change: 0 additions & 1 deletion test/flowr/server.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { assert } from 'chai'

describe('FlowR Server', withShell(shell => {
it('Correct Hello Message', withSocket(shell,async socket => {
await socket.waitForMessage('hello')
const messages = socket.getMessages()
assert.strictEqual(messages.length, 1, 'Expected exactly one message to hello the client')

Expand Down
7 changes: 4 additions & 3 deletions test/helper/net.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,9 @@ export function withSocket(shell: RShell, fn: (socket: FakeSocket, server: FakeS
const net = new FakeServer()
const server = new FlowRServer(shell, await defaultTokenMap(), net)
await server.start(42)
const exampleSocket = new FakeSocket()
net.connectClient(exampleSocket)
await fn(exampleSocket, net)
const socket = new FakeSocket()
net.connectClient(socket)
await socket.waitForMessage('hello')
await fn(socket, net)
}
}

0 comments on commit 4179305

Please sign in to comment.