node-postgres/packages/pg/test/integration/client/result-metadata-tests.js
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

49 lines
1.4 KiB
JavaScript

'use strict'
var helper = require('./test-helper')
var pg = helper.pg
const assert = require('assert')
const pool = new pg.Pool()
new helper.Suite().test('should return insert metadata', function () {
pool.connect(
assert.calls(function (err, client, done) {
assert(!err)
helper.versionGTE(
client,
90000,
assert.success(function (hasRowCount) {
client.query(
'CREATE TEMP TABLE zugzug(name varchar(10))',
assert.calls(function (err, result) {
assert(!err)
assert.equal(result.oid, null)
assert.equal(result.command, 'CREATE')
client.query(
"INSERT INTO zugzug(name) VALUES('more work?')",
assert.calls(function (err, result) {
assert(!err)
assert.equal(result.command, 'INSERT')
assert.equal(result.rowCount, 1)
client.query(
'SELECT * FROM zugzug',
assert.calls(function (err, result) {
assert(!err)
if (hasRowCount) assert.equal(result.rowCount, 1)
assert.equal(result.command, 'SELECT')
done()
process.nextTick(pool.end.bind(pool))
})
)
})
)
})
)
})
)
})
)
})