mirror of
https://github.com/brianc/node-postgres.git
synced 2025-12-08 20:16:25 +00:00
Add test for connectionString property delegation
This commit is contained in:
parent
f93385284d
commit
959d89e043
2
index.js
2
index.js
@ -96,7 +96,7 @@ Pool.prototype._create = function (cb) {
|
||||
client.connect(function (err) {
|
||||
if (err) {
|
||||
this.log('client connection error:', err)
|
||||
cb(err)
|
||||
cb(err, client)
|
||||
} else {
|
||||
this.log('client connected')
|
||||
this.emit('connect', client)
|
||||
|
||||
22
test/connection-strings.js
Normal file
22
test/connection-strings.js
Normal file
@ -0,0 +1,22 @@
|
||||
var expect = require('expect.js')
|
||||
var describe = require('mocha').describe
|
||||
var it = require('mocha').it
|
||||
var Pool = require('../')
|
||||
|
||||
describe('Connection strings', function () {
|
||||
it('pool delegates connectionString property to client', function () {
|
||||
var pool = new Pool({
|
||||
connectionString: 'postgres://foo:bar@baz:1234/xur'
|
||||
})
|
||||
pool.connect(function (err, client) {
|
||||
expect(err).to.not.be(undefined)
|
||||
expect(client).to.not.be(undefined)
|
||||
expect(client.username).to.equal('foo')
|
||||
expect(client.password).to.equal('bar')
|
||||
expect(client.database).to.equal('baz')
|
||||
expect(client.port).to.equal(1234)
|
||||
expect(client.database).to.equal('xur')
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user