333
schangxiang@126.com
2025-09-19 18966e02fb573c7e2bb0c6426ed792b38b910940
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
const expect = require('expect.js')
const describe = require('mocha').describe
const it = require('mocha').it
const Pool = require('../')
 
describe('Connection strings', function () {
  it('pool delegates connectionString property to client', function (done) {
    const connectionString = 'postgres://foo:bar@baz:1234/xur'
 
    const pool = new Pool({
      // use a fake client so we can check we're passed the connectionString
      Client: function (args) {
        expect(args.connectionString).to.equal(connectionString)
        return {
          connect: function (cb) {
            cb(new Error('testing'))
          },
          on: function () { }
        }
      },
      connectionString: connectionString
    })
 
    pool.connect(function (err, client) {
      expect(err).to.not.be(undefined)
      done()
    })
  })
})