Skip to content

Commit b16711f

Browse files
author
Shayon Mukherjee
committed
Skip adding options twice and extend specs
1 parent 52f67d3 commit b16711f

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

Diff for: packages/pg/lib/connection-parameters.js

-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,6 @@ class ConnectionParameters {
143143
add(params, this, 'application_name')
144144
add(params, this, 'fallback_application_name')
145145
add(params, this, 'connect_timeout')
146-
add(params, this, 'options')
147146

148147
addOption(pgOptions, this, 'statement_timeout')
149148
addOption(pgOptions, this, 'idle_in_transaction_session_timeout')

Diff for: packages/pg/test/unit/connection-parameters/creation-tests.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ test('libpq connection string building', function () {
157157
port: 888,
158158
host: 'localhost',
159159
database: 'bam',
160+
options: 'foobar',
160161
}
161162
var subject = new ConnectionParameters(config)
162163
subject.getLibpqConnectionString(
@@ -168,6 +169,7 @@ test('libpq connection string building', function () {
168169
checkForPart(parts, "port='888'")
169170
checkForPart(parts, "hostaddr='127.0.0.1'")
170171
checkForPart(parts, "dbname='bam'")
172+
checkForPart(parts, "options='foobar'")
171173
})
172174
)
173175
})
@@ -181,13 +183,14 @@ test('libpq connection string building', function () {
181183
database: 'bam',
182184
statement_timeout: 5000,
183185
idle_in_transaction_session_timeout: 5000,
186+
options: '-c geqo=off -c foobar=off',
184187
}
185188
var subject = new ConnectionParameters(config)
186189
subject.getLibpqConnectionString(
187190
assert.calls(function (err, constring) {
188191
assert(!err)
189192
var parts = constring.split(/ (?=([^\']*\'[^\']*\')*[^\']*$)/)
190-
checkForPart(parts, "options='-c statement_timeout=5000 -c idle_in_transaction_session_timeout=5000'")
193+
checkForPart(parts, "options='-c statement_timeout=5000 -c idle_in_transaction_session_timeout=5000 -c geqo=off -c foobar=off'")
191194
})
192195
)
193196
})

0 commit comments

Comments
 (0)