File tree 1 file changed +15
-1
lines changed
packages/pg/test/integration/gh-issues
1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -7,9 +7,23 @@ var assert = require('assert')
7
7
const suite = new helper . Suite ( )
8
8
9
9
suite . testAsync ( 'it should connect over ssl' , async ( ) => {
10
- const client = new helper . pg . Client ( { ssl : 'require' } )
10
+ const ssl = helper . args . native ? 'require' : {
11
+ rejectUnauthorized : false
12
+ }
13
+ const client = new helper . pg . Client ( { ssl } )
11
14
await client . connect ( )
12
15
const { rows } = await client . query ( 'SELECT NOW()' )
13
16
assert . strictEqual ( rows . length , 1 )
14
17
await client . end ( )
15
18
} )
19
+
20
+ suite . testAsync ( 'it should fail with self-signed cert error w/o rejectUnauthorized being passed' , async ( ) => {
21
+ const ssl = helper . args . native ? 'verify-ca' : { }
22
+ const client = new helper . pg . Client ( { ssl } )
23
+ try {
24
+ await client . connect ( )
25
+ } catch ( e ) {
26
+ return ;
27
+ }
28
+ throw new Error ( 'this test should have thrown an error due to self-signed cert' )
29
+ } )
You can’t perform that action at this time.
0 commit comments