mirror of
https://github.com/brianc/node-postgres.git
synced 2026-01-18 15:55:05 +00:00
* First crack at monorepo * Update test command * Update path to script * Remove node 6 from CI
35 lines
909 B
JavaScript
35 lines
909 B
JavaScript
'use strict'
|
|
var helper = require('./../test-helper')
|
|
var exec = require('child_process').exec
|
|
|
|
var oldTz = process.env.TZ
|
|
process.env.TZ = 'Europe/Berlin'
|
|
|
|
var date = new Date()
|
|
|
|
const pool = new helper.pg.Pool()
|
|
const suite = new helper.Suite()
|
|
|
|
pool.connect(function (err, client, done) {
|
|
assert(!err)
|
|
|
|
suite.test('timestamp without time zone', function (cb) {
|
|
client.query('SELECT CAST($1 AS TIMESTAMP WITHOUT TIME ZONE) AS "val"', [date], function (err, result) {
|
|
assert(!err)
|
|
assert.equal(result.rows[0].val.getTime(), date.getTime())
|
|
cb()
|
|
})
|
|
})
|
|
|
|
suite.test('timestamp with time zone', function (cb) {
|
|
client.query('SELECT CAST($1 AS TIMESTAMP WITH TIME ZONE) AS "val"', [date], function (err, result) {
|
|
assert(!err)
|
|
assert.equal(result.rows[0].val.getTime(), date.getTime())
|
|
|
|
done()
|
|
pool.end(cb)
|
|
process.env.TZ = oldTz
|
|
})
|
|
})
|
|
})
|