mirror of
https://github.com/brianc/node-postgres.git
synced 2025-12-08 20:16:25 +00:00
I didn't do much to "modernize" the pg-native codebase other than running it through the standard eslint --fix that is applied to the rest of the code. There's some easy opportunities there to update it to es6 and so on...it still uses some pretty antiquated coding styles in places. This PR re-introduces the native tests on node v20, and updates test matrix to drop unsupported versions of node & add in node v22.
29 lines
721 B
JavaScript
29 lines
721 B
JavaScript
var Client = require('../')
|
|
var assert = require('assert')
|
|
|
|
describe('multiple statements', () => {
|
|
before(() => {
|
|
this.client = new Client()
|
|
this.client.connectSync()
|
|
})
|
|
|
|
after(() => this.client.end())
|
|
|
|
it('works with multiple queries', (done) => {
|
|
const text = `
|
|
SELECT generate_series(1, 2) as foo;
|
|
SELECT generate_series(10, 11) as bar;
|
|
SELECT generate_series(20, 22) as baz;
|
|
`
|
|
this.client.query(text, (err, results) => {
|
|
if (err) return done(err)
|
|
assert(Array.isArray(results))
|
|
assert.equal(results.length, 3)
|
|
assert(Array.isArray(results[0]))
|
|
assert(Array.isArray(results[1]))
|
|
assert(Array.isArray(results[2]))
|
|
done()
|
|
})
|
|
})
|
|
})
|