mirror of
https://github.com/brianc/node-postgres.git
synced 2026-02-01 16:47:23 +00:00
* 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
32 lines
860 B
JavaScript
32 lines
860 B
JavaScript
'use strict'
|
|
var helper = require('./test-helper')
|
|
var pg = helper.pg
|
|
const suite = new helper.Suite()
|
|
const pool = new pg.Pool()
|
|
const assert = require('assert')
|
|
|
|
suite.test('can access results when no rows are returned', function (done) {
|
|
var checkResult = function (result) {
|
|
assert(result.fields, 'should have fields definition')
|
|
assert.equal(result.fields.length, 1)
|
|
assert.equal(result.fields[0].name, 'val')
|
|
assert.equal(result.fields[0].dataTypeID, 25)
|
|
}
|
|
|
|
pool.connect(
|
|
assert.success(function (client, release) {
|
|
const q = new pg.Query('select $1::text as val limit 0', ['hi'])
|
|
var query = client.query(
|
|
q,
|
|
assert.success(function (result) {
|
|
checkResult(result)
|
|
release()
|
|
pool.end(done)
|
|
})
|
|
)
|
|
|
|
assert.emits(query, 'end', checkResult)
|
|
})
|
|
)
|
|
})
|