mirror of
https://github.com/brianc/node-postgres.git
synced 2025-12-08 20:16:25 +00:00
37 lines
851 B
JavaScript
37 lines
851 B
JavaScript
const Client = require('../')
|
|
const assert = require('assert')
|
|
|
|
describe('connection', function () {
|
|
it('works', function (done) {
|
|
Client().connect(done)
|
|
})
|
|
|
|
it('connects with args', function (done) {
|
|
Client().connect('host=localhost', done)
|
|
})
|
|
|
|
it('errors out with bad connection args', function (done) {
|
|
Client().connect('host=asldkfjasdf', function (err) {
|
|
assert(err, 'should raise an error for bad host')
|
|
done()
|
|
})
|
|
})
|
|
})
|
|
|
|
describe('connectSync', function () {
|
|
it('works without args', function () {
|
|
Client().connectSync()
|
|
})
|
|
|
|
it('works with args', function () {
|
|
const args = 'host=' + (process.env.PGHOST || 'localhost')
|
|
Client().connectSync(args)
|
|
})
|
|
|
|
it('throws if bad host', function () {
|
|
assert.throws(function () {
|
|
Client().connectSync('host=laksdjfdsf')
|
|
})
|
|
})
|
|
})
|