Skip to content

Commit 712d8c4

Browse files
committed
moved server code to connection test
1 parent b44ea1a commit 712d8c4

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

test/unit/cmap/connection.test.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,12 +211,16 @@ describe('new Connection()', function () {
211211
hostAddress: server.hostAddress()
212212
};
213213

214+
const serverSpy = sinon.spy(server, 'command');
214215
const connectAsync = promisify(connect);
215216
const connection: Connection = await connectAsync(options);
216217
const commandSpy = sinon.spy(connection, 'command');
217218

218-
connection.commandAsync(ns('dummy'), { ping: 1 }, {});
219-
await expect(commandSpy).to.have.been.calledOnce;
219+
await connection.commandAsync(ns('dummy'), { ping: 1 }, {});
220+
expect(commandSpy).to.have.been.calledOnce;
221+
222+
await server.commandAsync(ns('dummy'), { ping: 1 }, {});
223+
expect(serverSpy).to.have.been.calledOnce;
220224
});
221225

222226
it('throws a network error with kBeforeHandshake set to true on timeout before handshake', function (done) {

0 commit comments

Comments
 (0)