diff --git a/src/connection-manager/index.ts b/src/connection-manager/index.ts index 0c40953863..80d041589a 100644 --- a/src/connection-manager/index.ts +++ b/src/connection-manager/index.ts @@ -167,12 +167,10 @@ export class DefaultConnectionManager extends EventEmitter { expect(spy).to.have.property('callCount', 1) }) + it('should fail if the connection manager has negative maxConnections limit', async () => { + await expect(createNode({ + config: createBaseOptions({ + connectionManager: { maxConnections: -5 } + }), + started: false + })).to.eventually.rejected('maxConnections must be greater than 0').with.property('code', codes.ERR_INVALID_PARAMETERS) + }) + + it('should fail if the connection manager has negative minConnections limit', async () => { + await expect(createNode({ + config: createBaseOptions({ + connectionManager: { minConnections: -5 } + }), + started: false + })).to.eventually.rejected('minConnections must be greater than 0').with.property('code', codes.ERR_INVALID_PARAMETERS) + }) + + it('should fail if the connection manager has non-integer maxConnections limit', async () => { + await expect(createNode({ + config: createBaseOptions({ + connectionManager: { maxConnections: 1.5 } + }), + started: false + })).to.eventually.rejected('maxConnections must be an integer').with.property('code', codes.ERR_INVALID_PARAMETERS) + }) + + it('should fail if the connection manager has non-integer minConnections limit', async () => { + await expect(createNode({ + config: createBaseOptions({ + connectionManager: { minConnections: 1.5 } + }), + started: false + })).to.eventually.rejected('minConnections must be an integer').with.property('code', codes.ERR_INVALID_PARAMETERS) + }) + it('should fail if the connection manager has mismatched connection limit options', async () => { await expect(createNode({ config: createBaseOptions({