connection-parse
Advanced tools
Comparing version 0.0.6 to 0.0.7
@@ -91,4 +91,4 @@ 'use strict'; | ||
server.weight = +server.weight || typeof value === 'object' | ||
? +value.weight || 0 | ||
: 0; | ||
? +value.weight || 1 | ||
: 1; | ||
@@ -104,3 +104,3 @@ return server; | ||
, string: server | ||
, weight: (typeof value === 'object' ? +value.weight : +value) || 0 | ||
, weight: (typeof value === 'object' ? +value.weight : +value) || 1 | ||
}; | ||
@@ -107,0 +107,0 @@ |
{ | ||
"name": "connection-parse", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"description": "Simple TCP connection string parser", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -15,2 +15,4 @@ 'use strict'; | ||
describe('connection-parse()', function () { | ||
var weight = 1; | ||
it('accepts multiple arguments', function () { | ||
@@ -24,3 +26,3 @@ var res = parse('1.1.1.1:1111', '11.11.11:1111'); | ||
Object.keys(res.weights).forEach(function (server) { | ||
expect(res.weights[server]).to.equal(0); | ||
expect(res.weights[server]).to.equal(weight); | ||
}); | ||
@@ -32,3 +34,3 @@ | ||
expect(server.string).to.be.a('string'); | ||
expect(server.weight).to.equal(0); | ||
expect(server.weight).to.equal(weight); | ||
}); | ||
@@ -49,3 +51,3 @@ | ||
Object.keys(res.weights).forEach(function (server) { | ||
expect(res.weights[server]).to.equal(0); | ||
expect(res.weights[server]).to.equal(weight); | ||
}); | ||
@@ -57,3 +59,3 @@ | ||
expect(server.string).to.be.a('string'); | ||
expect(server.weight).to.equal(0); | ||
expect(server.weight).to.equal(weight); | ||
}); | ||
@@ -117,3 +119,3 @@ | ||
res.servers.forEach(function (server) { | ||
expect(server.weight).to.equal(0); | ||
expect(server.weight).to.equal(weight); | ||
}); | ||
@@ -130,3 +132,3 @@ }); | ||
Object.keys(res.weights).forEach(function (server) { | ||
expect(res.weights[server]).to.equal(0); | ||
expect(res.weights[server]).to.equal(weight); | ||
}); | ||
@@ -138,3 +140,3 @@ | ||
expect(server.host).to.equal('1.1.1.1'); | ||
expect(server.weight).to.equal(0); | ||
expect(server.weight).to.equal(weight); | ||
}); | ||
@@ -162,3 +164,3 @@ | ||
expect(server.host).to.equal('1.1.1.1'); | ||
expect(server.weight).to.equal(0); | ||
expect(server.weight).to.equal(weight); | ||
expect(server.vnode).to.equal(11); | ||
@@ -165,0 +167,0 @@ }); |
9750
237