@@ -27,14 +27,15 @@ test('ConnectionConfig#Constructor', {
27
27
} ,
28
28
29
29
'allows additional options via url query' : function ( ) {
30
- var url = 'mysql://myhost/mydb?debug=true&charset=BIG5_CHINESE_CI' ;
30
+ var url = 'mysql://myhost/mydb?debug=true&charset=BIG5_CHINESE_CI&timezone=Z ' ;
31
31
var config = new ConnectionConfig ( url ) ;
32
32
33
33
assert . equal ( config . host , 'myhost' ) ;
34
34
assert . equal ( config . port , 3306 ) ;
35
35
assert . equal ( config . database , 'mydb' ) ;
36
36
assert . equal ( config . debug , true ) ;
37
37
assert . equal ( config . charsetNumber , common . Charsets . BIG5_CHINESE_CI ) ;
38
+ assert . equal ( config . timezone , 'Z' ) ;
38
39
} ,
39
40
40
41
'accepts client flags' : function ( ) {
@@ -179,6 +180,24 @@ test('ConnectionConfig#Constructor.ssl', {
179
180
}
180
181
} ) ;
181
182
183
+ test ( 'ConnectionConfig#Constructor.timezone' , {
184
+ 'defaults to "local"' : function ( ) {
185
+ var config = new ConnectionConfig ( { } ) ;
186
+
187
+ assert . equal ( config . timezone , 'local' ) ;
188
+ } ,
189
+
190
+ 'accepts url timezone with encoded +' : function ( ) {
191
+ var config = new ConnectionConfig ( 'mysql://myhost/mydb?timezone=%2b0200' ) ;
192
+ assert . equal ( config . timezone , '+0200' ) ;
193
+ } ,
194
+
195
+ 'accepts url timezone with literal +' : function ( ) {
196
+ var config = new ConnectionConfig ( 'mysql://myhost/mydb?timezone=+0200' ) ;
197
+ assert . equal ( config . timezone , '+0200' ) ;
198
+ }
199
+ } ) ;
200
+
182
201
test ( 'ConnectionConfig#mergeFlags' , {
183
202
'adds flag to empty list' : function ( ) {
184
203
var initial = '' ;
0 commit comments