@@ -32,34 +32,34 @@ describe('parse', () => {
32
32
} ) ;
33
33
34
34
it ( 'initializing with unix domain socket' , ( ) => {
35
- const subject1 = parse ( '?socket=' + encodeURIComponent ( '/const/run/' ) ) ;
35
+ const subject1 = parse ( '%2Fconst%2Frun%2F' ) ;
36
36
subject1 . host . should . equal ( '/const/run/' ) ;
37
37
const subject2 = parse ( 'test.domain.sock' ) ;
38
38
subject2 . host . should . equal ( 'test.domain.sock' ) ;
39
39
} ) ;
40
40
41
41
it ( 'initializing with unix domain socket and a specific database, the simple way' , ( ) => {
42
- const subject = parse ( '/mydb?socket=' + encodeURIComponent ( '/const/run/' ) ) ;
42
+ const subject = parse ( '%2Fconst%2Frun%2F /mydb' ) ;
43
43
subject . host . should . equal ( '/const/run/' ) ;
44
44
subject . database . should . equal ( 'mydb' ) ;
45
45
} ) ;
46
46
47
47
it ( 'initializing with unix domain socket, the healthy way' , ( ) => {
48
- const subject = parse ( '/my%5Bdb%5D?encoding=utf8&socket=' + encodeURIComponent ( '/some path/' ) ) ;
48
+ const subject = parse ( '%2Fsome%20path%2F /my%5Bdb%5D?encoding=utf8' ) ;
49
49
subject . host . should . equal ( '/some path/' ) ;
50
- subject . database . should . equal ( 'my[db]' , 'must to be escaped and unescaped trough "my%5Bdb%5D"' ) ;
50
+ subject . database . should . equal ( 'my[db]' , 'must be escaped and unescaped trough "my%5Bdb%5D"' ) ;
51
51
subject . client_encoding . should . equal ( 'utf8' ) ;
52
52
} ) ;
53
53
54
54
it ( 'initializing with unix domain socket, the escaped healthy way' , ( ) => {
55
- const subject = parse ( '/my%2Bdb?encoding=utf8&socket=' + encodeURIComponent ( '/some path/' ) ) ;
55
+ const subject = parse ( '%2Fsome%20path%2F /my%2Bdb?encoding=utf8' ) ;
56
56
subject . host . should . equal ( '/some path/' ) ;
57
57
subject . database . should . equal ( 'my+db' ) ;
58
58
subject . client_encoding . should . equal ( 'utf8' ) ;
59
59
} ) ;
60
60
61
61
it ( 'initializing with unix domain socket, username and password' , ( ) => {
62
- const subject = parse ( 'postgres://brian:pw@/mydb?socket=' + encodeURIComponent ( '/const/run/' ) ) ;
62
+ const subject = parse ( 'postgres://brian:pw@%2Fconst%2Frun%2F /mydb' ) ;
63
63
subject . user . should . equal ( 'brian' ) ;
64
64
subject . password . should . equal ( 'pw' ) ;
65
65
subject . host . should . equal ( '/const/run/' ) ;
0 commit comments