Skip to content

Commit e50936c

Browse files
committed
chore: fix lint
1 parent a18467f commit e50936c

File tree

2 files changed

+46
-41
lines changed

2 files changed

+46
-41
lines changed

packages/pg/test/integration/client/max-result-size-tests.js

Lines changed: 46 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -4,85 +4,92 @@ var assert = require('assert')
44
const { Client } = helper.pg
55
const suite = new helper.Suite()
66

7-
87
// Basic test to check if the _maxResultSize property is passed to Connection
98
suite.test('client passes maxResultSize to connection', function (done) {
109
var client = new Client({
1110
...helper.args,
12-
maxResultSize: 1024 * 1024 // 1MB limit
11+
maxResultSize: 1024 * 1024, // 1MB limit
1312
})
14-
15-
client.connect(assert.success(function () {
16-
assert.equal(client.connection._maxResultSize, 1024 * 1024,
17-
'maxResultSize should be passed to the connection')
18-
client.end(done)
19-
}))
13+
14+
client.connect(
15+
assert.success(function () {
16+
assert.equal(client.connection._maxResultSize, 1024 * 1024, 'maxResultSize should be passed to the connection')
17+
client.end(done)
18+
})
19+
)
2020
})
2121

2222
// Check if the correct attachListeners method is being used based on maxResultSize
2323
suite.test('connection uses correct listener implementation', function (done) {
2424
var client = new Client({
2525
...helper.args,
26-
maxResultSize: 1024 * 1024 // 1MB limit
26+
maxResultSize: 1024 * 1024, // 1MB limit
2727
})
28-
29-
client.connect(assert.success(function () {
30-
// Just a simple check to see if our methods exist on the connection object
31-
assert(typeof client.connection._attachListenersStandard === 'function',
32-
'Standard listener method should exist')
33-
assert(typeof client.connection._attachListenersWithSizeLimit === 'function',
34-
'Size-limiting listener method should exist')
35-
client.end(done)
36-
}))
28+
29+
client.connect(
30+
assert.success(function () {
31+
// Just a simple check to see if our methods exist on the connection object
32+
assert(typeof client.connection._attachListenersStandard === 'function', 'Standard listener method should exist')
33+
assert(
34+
typeof client.connection._attachListenersWithSizeLimit === 'function',
35+
'Size-limiting listener method should exist'
36+
)
37+
client.end(done)
38+
})
39+
)
3740
})
3841

3942
// Test that small result sets complete successfully with maxResultSize set
4043
suite.test('small result with maxResultSize', function (done) {
4144
var client = new Client({
4245
...helper.args,
43-
maxResultSize: 1024 * 1024 // 1MB limit
46+
maxResultSize: 1024 * 1024, // 1MB limit
4447
})
45-
46-
client.connect(assert.success(function () {
47-
client.query('SELECT generate_series(1, 10) as num', assert.success(function(result) {
48-
assert.equal(result.rows.length, 10)
49-
client.end(done)
50-
}))
51-
}))
48+
49+
client.connect(
50+
assert.success(function () {
51+
client.query(
52+
'SELECT generate_series(1, 10) as num',
53+
assert.success(function (result) {
54+
assert.equal(result.rows.length, 10)
55+
client.end(done)
56+
})
57+
)
58+
})
59+
)
5260
})
5361

5462
// Test for large result size
5563
// Using a separate test to avoid issue with callback being called twice
5664
suite.testAsync('large result triggers error', async () => {
5765
const client = new Client({
5866
...helper.args,
59-
maxResultSize: 500 // Very small limit
67+
maxResultSize: 500, // Very small limit
6068
})
6169

6270
// Setup error handler
63-
const errorPromise = new Promise(resolve => {
64-
client.on('error', err => {
71+
const errorPromise = new Promise((resolve) => {
72+
client.on('error', (err) => {
6573
assert.equal(err.message, 'Query result size exceeded the configured limit')
6674
assert.equal(err.code, 'RESULT_SIZE_EXCEEDED')
6775
resolve()
6876
})
6977
})
7078

7179
await client.connect()
72-
80+
7381
// Start the query but don't await it (it will error)
74-
const queryPromise = client.query('SELECT repeat(\'x\', 1000) as data FROM generate_series(1, 100)')
75-
.catch(() => {
76-
// We expect this to error out, silence the rejection
77-
return null
78-
})
79-
82+
const queryPromise = client.query("SELECT repeat('x', 1000) as data FROM generate_series(1, 100)").catch(() => {
83+
// We expect this to error out, silence the rejection
84+
return null
85+
})
86+
8087
// Wait for error event
8188
await errorPromise
82-
89+
8390
// Make sure the query is done before we end
8491
await queryPromise
85-
92+
8693
// Clean up
8794
await client.end().catch(() => {})
88-
})
95+
})

packages/pg/test/integration/connection-pool/result-size-limit-tests.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ const helper = require('../test-helper')
44
const pg = helper.pg
55
var assert = require('assert')
66

7-
87
const suite = new helper.Suite()
98

109
// Test that the pool respects the maxResultSize option
@@ -58,4 +57,3 @@ suite.test('pool query works with adequate maxResultSize', (done) => {
5857
pool.end(done)
5958
})
6059
})
61-

0 commit comments

Comments
 (0)