mirror of
https://github.com/brianc/node-postgres.git
synced 2025-12-08 20:16:25 +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
21 lines
509 B
JavaScript
21 lines
509 B
JavaScript
'use strict'
|
|
var helper = require('./test-helper')
|
|
var co = require('co')
|
|
|
|
const pool = new helper.pg.Pool()
|
|
new helper.Suite().test('using coroutines works with promises', co.wrap(function * () {
|
|
var client = yield pool.connect()
|
|
var res = yield client.query('SELECT $1::text as name', ['foo'])
|
|
assert.equal(res.rows[0].name, 'foo')
|
|
|
|
var threw = false
|
|
try {
|
|
yield client.query('SELECT LKDSJDSLKFJ')
|
|
} catch (e) {
|
|
threw = true
|
|
}
|
|
assert(threw)
|
|
client.release()
|
|
yield pool.end()
|
|
}))
|