mirror of
https://github.com/brianc/node-postgres.git
synced 2026-01-25 16:03:13 +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
35 lines
1.0 KiB
JavaScript
35 lines
1.0 KiB
JavaScript
'use strict'
|
|
var helper = require('../test-helper')
|
|
var pg = helper.pg
|
|
const assert = require('assert')
|
|
|
|
var suite = new helper.Suite()
|
|
|
|
suite.test('parsing array decimal results', function (done) {
|
|
const pool = new pg.Pool()
|
|
pool.connect(
|
|
assert.calls(function (err, client, release) {
|
|
assert(!err)
|
|
client.query('CREATE TEMP TABLE why(names text[], numbors integer[], decimals double precision[])')
|
|
client
|
|
.query(
|
|
new pg.Query(
|
|
'INSERT INTO why(names, numbors, decimals) VALUES(\'{"aaron", "brian","a b c" }\', \'{1, 2, 3}\', \'{.1, 0.05, 3.654}\')'
|
|
)
|
|
)
|
|
.on('error', console.log)
|
|
client.query(
|
|
'SELECT decimals FROM why',
|
|
assert.success(function (result) {
|
|
assert.lengthIs(result.rows[0].decimals, 3)
|
|
assert.equal(result.rows[0].decimals[0], 0.1)
|
|
assert.equal(result.rows[0].decimals[1], 0.05)
|
|
assert.equal(result.rows[0].decimals[2], 3.654)
|
|
release()
|
|
pool.end(done)
|
|
})
|
|
)
|
|
})
|
|
)
|
|
})
|