Brian C fe88e825e5
Add pg-native to monorepo (#3225)
I didn't do much to "modernize" the pg-native codebase other than running it through the standard eslint --fix that is applied to the rest of the code. There's some easy opportunities there to update it to es6 and so on...it still uses some pretty antiquated coding styles in places.  This PR re-introduces the native tests on node v20, and updates test matrix to drop unsupported versions of node & add in node v22.
2024-06-04 10:26:11 -05:00

37 lines
845 B
JavaScript

var Client = require('../')
var 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 () {
var args = 'host=' + (process.env.PGHOST || 'localhost')
Client().connectSync(args)
})
it('throws if bad host', function () {
assert.throws(function () {
Client().connectSync('host=laksdjfdsf')
})
})
})