File tree 1 file changed +32
-0
lines changed
1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change
1
+ var assert = require ( 'assert' ) ;
2
+ var common = require ( '../common' ) ;
3
+ var test = require ( 'utest' ) ;
4
+ var Charsets = require ( common . lib + '/protocol/constants/charsets' ) ;
5
+ var PoolConfig = require ( common . lib + '/PoolConfig' ) ;
6
+
7
+ test ( 'PoolConfig#Constructor' , {
8
+ 'works with combined object' : function ( ) {
9
+ var config = new PoolConfig ( {
10
+ connectionLimit : 2 ,
11
+ host : 'remote' ,
12
+ port : 3333
13
+ } ) ;
14
+
15
+ assert . ok ( config . connectionConfig ) ;
16
+ assert . equal ( config . connectionConfig . host , 'remote' ) ;
17
+ assert . equal ( config . connectionConfig . port , 3333 ) ;
18
+ assert . equal ( config . connectionLimit , 2 ) ;
19
+ } ,
20
+
21
+ 'works with connection string' : function ( ) {
22
+ var url = 'mysql://myhost:3333/mydb?debug=true&charset=BIG5_CHINESE_CI' ;
23
+ var config = new PoolConfig ( url ) ;
24
+
25
+ assert . ok ( config . connectionConfig ) ;
26
+ assert . equal ( config . connectionConfig . host , 'myhost' ) ;
27
+ assert . equal ( config . connectionConfig . port , 3333 ) ;
28
+ assert . equal ( config . connectionConfig . database , 'mydb' ) ;
29
+ assert . equal ( config . connectionConfig . debug , true ) ;
30
+ assert . equal ( config . connectionConfig . charsetNumber , Charsets . BIG5_CHINESE_CI ) ;
31
+ } ,
32
+ } ) ;
You can’t perform that action at this time.
0 commit comments