| 813 | } |
| 814 | |
| 815 | function newConnectedInstance(requestHandlerMock, options, prepareHandlerMock) { |
| 816 | const Client = proxyquire('../../lib/client', { |
| 817 | './request-handler': requestHandlerMock || function () {}, |
| 818 | './prepare-handler': prepareHandlerMock || function () {} |
| 819 | }); |
| 820 | |
| 821 | const client = new Client(utils.extend({}, helper.baseOptions, options)); |
| 822 | client._getEncoder = () => new Encoder(2, {}); |
| 823 | client.connect = helper.callbackNoop; |
| 824 | client._connect = async () => {}; |
| 825 | |
| 826 | return client; |
| 827 | } |
| 828 | |
| 829 | function getConnections(length = 1) { |
| 830 | return Array(length).fill(0).map(() => ({ closeAsync: sinon.spy(() => Promise.resolve()) })); |