Brian C 50c06f9bc6
Remove test globals (#3264)
* Remove assert from globals

* Remove Client from globals

* Remove global test function

* Remove MemoryStream from globals

* Require assert in SASL integration tests

* Attempt to use a postgres with ssl?

* Use latest image

* Remove connection tests - they test internals that are better covered by testint the client
2024-06-19 13:46:16 -05:00

39 lines
1.3 KiB
JavaScript

'use strict'
var helper = require('../test-helper')
var pg = helper.pg
const suite = new helper.Suite()
const assert = require('assert')
const pool = new pg.Pool(helper.config)
suite.test('ability to turn on and off parser', function () {
if (helper.args.binary) return false
pool.connect(
assert.success(function (client, done) {
pg.defaults.parseInt8 = true
client.query('CREATE TEMP TABLE asdf(id SERIAL PRIMARY KEY)')
client.query(
'SELECT COUNT(*) as "count", \'{1,2,3}\'::bigint[] as array FROM asdf',
assert.success(function (res) {
assert.strictEqual(0, res.rows[0].count)
assert.strictEqual(1, res.rows[0].array[0])
assert.strictEqual(2, res.rows[0].array[1])
assert.strictEqual(3, res.rows[0].array[2])
pg.defaults.parseInt8 = false
client.query(
'SELECT COUNT(*) as "count", \'{1,2,3}\'::bigint[] as array FROM asdf',
assert.success(function (res) {
done()
assert.strictEqual('0', res.rows[0].count)
assert.strictEqual('1', res.rows[0].array[0])
assert.strictEqual('2', res.rows[0].array[1])
assert.strictEqual('3', res.rows[0].array[2])
pool.end()
})
)
})
)
})
)
})