From 3acfaafb2ac41e0160b91dd6e11705c905bbd14e Mon Sep 17 00:00:00 2001 From: Nicolas Dextraze Date: Tue, 6 Dec 2016 18:54:04 -0800 Subject: [PATCH] 14 - fix creationConnection with tcp://host:port failing --- src/eventStoreConnection.js | 2 +- test/connection_test.js | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/eventStoreConnection.js b/src/eventStoreConnection.js index c64c666..9c984ac 100644 --- a/src/eventStoreConnection.js +++ b/src/eventStoreConnection.js @@ -56,7 +56,7 @@ function createFromTcpEndpoint(settings, tcpEndpoint, connectionName) { } function createFromStringEndpoint(settings, endPoint, connectionName) { - var m = endPoint.match(/^(tcp|discover):\/\/([^:]):?(\d+)?$/); + var m = endPoint.match(/^(tcp|discover):\/\/([^:]+):?(\d+)?$/); if (!m) throw new Error('endPoint string must be tcp://hostname[:port] or discover://dns[:port]'); var scheme = m[1]; var hostname = m[2]; diff --git a/test/connection_test.js b/test/connection_test.js index 8414db9..23ca1cc 100644 --- a/test/connection_test.js +++ b/test/connection_test.js @@ -41,6 +41,11 @@ module.exports = { test.ok(reason.indexOf("Reconnection limit reached") === 0, "Wrong expected reason."); test.done(); }); + }, + 'Create a connection with tcp://host:port string': function(test) { + var conn = client.createConnection({}, 'tcp://localhost:2113'); + conn.close(); + test.done(); }/*, 'Connect to Cluster using gossip seeds': function (test) { test.expect(1);