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.
31 lines
645 B
JavaScript
31 lines
645 B
JavaScript
var Client = require('../')
|
|
var async = require('async')
|
|
var ok = require('okay')
|
|
|
|
var execute = function (x, done) {
|
|
var client = new Client()
|
|
client.connectSync()
|
|
var query = function (n, cb) {
|
|
client.query('SELECT $1::int as num', [n], function (err) {
|
|
cb(err)
|
|
})
|
|
}
|
|
return async.timesSeries(
|
|
5,
|
|
query,
|
|
ok(done, function () {
|
|
client.end()
|
|
done()
|
|
})
|
|
)
|
|
}
|
|
describe('Load tests', function () {
|
|
it('single client and many queries', function (done) {
|
|
async.times(1, execute, done)
|
|
})
|
|
|
|
it('multiple client and many queries', function (done) {
|
|
async.times(20, execute, done)
|
|
})
|
|
})
|