Skip to content

Commit 8bb43bc

Browse files
authored
fix: assert
1 parent b92a970 commit 8bb43bc

1 file changed

Lines changed: 11 additions & 12 deletions

File tree

packages/pg/test/integration/client/pipeline-tests.js

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,22 @@
22

33
const helper = require('../test-helper')
44
const { Client } = require('../../../')
5+
const assert = require('assert')
56

67
const suite = new helper.Suite()
78

89
suite.test('pipelining property can be set and retrieved', (cb) => {
910
const client = new Client(helper.config)
1011
// Initially false
11-
helper.assert.equal(client.pipelining, false)
12+
assert.strictEqual(client.pipelining, false)
1213
client.connect((err) => {
1314
if (err) return cb(err)
1415
// Can be set to true after connection
1516
client.pipelining = true
16-
helper.assert.equal(client.pipelining, true)
17+
assert.strictEqual(client.pipelining, true)
1718
// Can be set back to false
1819
client.pipelining = false
19-
helper.assert.equal(client.pipelining, false)
20+
assert.strictEqual(client.pipelining, false)
2021
client.end(cb)
2122
})
2223
})
@@ -25,9 +26,9 @@ suite.test('cannot enable pipelining before connection', (cb) => {
2526
const client = new Client(helper.config)
2627
try {
2728
client.pipelining = true
28-
helper.assert.fail('Should have thrown error')
29+
assert.fail('Should have thrown error')
2930
} catch (err) {
30-
helper.assert.equal(err.message, 'Cannot enable pipelining mode before connection is established')
31+
assert.strictEqual(err.message, 'Cannot enable pipelining mode before connection is established')
3132
cb()
3233
}
3334
})
@@ -59,9 +60,9 @@ suite.test('pipelining mode allows multiple parameterized queries', (cb) => {
5960
if (completed === 3) checkResults()
6061
})
6162
function checkResults() {
62-
helper.assert.equal(results[0].rows[0].message, 'Hello')
63-
helper.assert.equal(results[1].rows[0].number, 42)
64-
helper.assert.equal(results[2].rows[0].greeting, 'World')
63+
assert.strictEqual(results[0].rows[0].message, 'Hello')
64+
assert.strictEqual(results[1].rows[0].number, 42)
65+
assert.strictEqual(results[2].rows[0].greeting, 'World')
6566
client.end(cb)
6667
}
6768
})
@@ -73,8 +74,7 @@ suite.test('pipelining mode rejects simple queries', (cb) => {
7374
if (err) return cb(err)
7475
client.pipelining = true
7576
client.query('SELECT 1', (err, result) => {
76-
helper.assert(err)
77-
helper.assert.equal(
77+
assert.strictEqual(
7878
err.message,
7979
'Simple query protocol is not allowed in pipeline mode. Use parameterized queries.'
8080
)
@@ -89,8 +89,7 @@ suite.test('pipelining mode rejects multi-statement queries', (cb) => {
8989
if (err) return cb(err)
9090
client.pipelining = true
9191
client.query('SELECT $1; SELECT $2', [1, 2], (err, result) => {
92-
helper.assert(err)
93-
helper.assert.equal(err.message, 'Multiple SQL commands in a single query are not allowed in pipeline mode')
92+
assert.strictEqual(err.message, 'Multiple SQL commands in a single query are not allowed in pipeline mode')
9493
client.end(cb)
9594
})
9695
})

0 commit comments

Comments
 (0)