Skip to content

Commit 8e970e8

Browse files
committed
update test
1 parent 8502616 commit 8e970e8

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

test/unit/sdam/server_discovery_and_monitoring.prose.test.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,12 @@ describe('Heartbeat tests', function () {
1414
// Create TCP server that responds to hellos by closing the connection
1515
// and pushing "client connection created" to shared array
1616
server = createServer(clientSocket => {
17-
console.log(`connection from ${clientSocket.remoteAddress}`);
1817
events.push('client connected');
19-
clientSocket.end();
18+
19+
clientSocket.once('data', () => {
20+
events.push('client hello received');
21+
clientSocket.end();
22+
});
2023
});
2124
server.listen(9999);
2225

@@ -50,10 +53,11 @@ describe('Heartbeat tests', function () {
5053
if (server.listening) server.close();
5154
});
5255

53-
it('emits the first HeartbeatStartedEvent after the monitoring socket was created', async function () {
54-
expect(events).to.have.lengthOf(3);
56+
it('emits the first HeartbeatStartedEvent after the monitoring socket was created and before hello is sent', async function () {
57+
expect(events).to.have.lengthOf(4);
5558
expect(events[0]).to.equal('client connection created');
5659
expect(events[1]).to.equal(SERVER_HEARTBEAT_STARTED);
60+
expect(events[2]).to.equal('client hello received');
5761
expect(events[3]).to.equal(SERVER_HEARTBEAT_FAILED);
5862
});
5963
});

0 commit comments

Comments
 (0)