1 | const expect = require('expect.js')
|
2 | const describe = require('mocha').describe
|
3 | const it = require('mocha').it
|
4 | const Pool = require('../')
|
5 |
|
6 | describe('Connection strings', function () {
|
7 | it('pool delegates connectionString property to client', function (done) {
|
8 | const connectionString = 'postgres://foo:bar@baz:1234/xur'
|
9 |
|
10 | const pool = new Pool({
|
11 |
|
12 | Client: function (args) {
|
13 | expect(args.connectionString).to.equal(connectionString)
|
14 | return {
|
15 | connect: function (cb) {
|
16 | cb(new Error('testing'))
|
17 | },
|
18 | on: function () {},
|
19 | }
|
20 | },
|
21 | connectionString: connectionString,
|
22 | })
|
23 |
|
24 | pool.connect(function (err, client) {
|
25 | expect(err).to.not.be(undefined)
|
26 | done()
|
27 | })
|
28 | })
|
29 | })
|