mirror of
https://github.com/brianc/node-postgres.git
synced 2026-01-25 16:03:13 +00:00
* Work on converting lib to standard * Finish updating lib * Finish linting lib * Format test files * Add .eslintrc with standard format * Supply full path to eslint bin * Move lint command to package.json * Add eslint as dev dependency
29 lines
802 B
JavaScript
29 lines
802 B
JavaScript
'use strict'
|
|
var helper = require('./test-helper')
|
|
var pg = helper.pg
|
|
const suite = new helper.Suite()
|
|
const pool = new pg.Pool()
|
|
|
|
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)
|
|
})
|
|
)
|
|
})
|