File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed
test/unit/connection-parameters Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -138,12 +138,21 @@ test('libpq connection string building', function() {
138
138
assert . equal ( subject . password , sourceConfig . password ) ;
139
139
} ) ;
140
140
141
- test ( 'password contains weird characters' , function ( ) {
142
- var strang = 'pg://my first name:is&%awesome!@localhost:9000' ;
141
+ test ( 'username or password contains weird characters' , function ( ) {
142
+ var strang = 'pg://my f%irst name:is&%awesome!@localhost:9000' ;
143
143
var subject = new ConnectionParameters ( strang ) ;
144
- assert . equal ( subject . user , 'my first name' ) ;
144
+ assert . equal ( subject . user , 'my f%irst name' ) ;
145
145
assert . equal ( subject . password , 'is&%awesome!' ) ;
146
146
assert . equal ( subject . host , 'localhost' ) ;
147
147
} ) ;
148
+
149
+ test ( "url is properly encoded" , function ( ) {
150
+ var encoded = "pg://bi%25na%25%25ry%20:s%40f%23@localhost/%20u%2520rl" ;
151
+ var subject = new ConnectionParameters ( encoded ) ;
152
+ assert . equal ( subject . user , "bi%na%%ry " ) ;
153
+ assert . equal ( subject . password , "s@f#" ) ;
154
+ assert . equal ( subject . host , 'localhost' ) ;
155
+ assert . equal ( subject . path , " u%20rl" ) ;
156
+ } ) ;
148
157
149
158
} ) ;
You can’t perform that action at this time.
0 commit comments