@@ -27,13 +27,13 @@ const baseURI = 'postgres://username:password@localhost:5432/db-name';
2727const testfile = fs . readFileSync ( './Dockerfile' ) . toString ( ) ;
2828const dbOptionsTest = { } ;
2929dbOptionsTest [
30- `${ baseURI } ?ssl=true&binary=true&application_name=app_name&fallback_application_name=f_app_name&poolSize=10 `
30+ `${ baseURI } ?ssl=true&binary=true&application_name=app_name&fallback_application_name=f_app_name&poolSize=12 `
3131] = {
3232 ssl : true ,
3333 binary : true ,
3434 application_name : 'app_name' ,
3535 fallback_application_name : 'f_app_name' ,
36- poolSize : 10 ,
36+ max : 12 ,
3737} ;
3838dbOptionsTest [ `${ baseURI } ?ssl=&binary=aa` ] = {
3939 binary : false ,
@@ -83,6 +83,20 @@ describe('PostgresConfigParser.getDatabaseOptionsFromURI', () => {
8383 it ( 'sets the poolSize to 10 if the it is not a number' , ( ) => {
8484 const result = parser . getDatabaseOptionsFromURI ( `${ baseURI } ?poolSize=sdf` ) ;
8585
86- expect ( result . poolSize ) . toEqual ( 10 ) ;
86+ expect ( result . max ) . toEqual ( 10 ) ;
87+ } ) ;
88+
89+ it ( 'sets the max to 10 if the it is not a number' , ( ) => {
90+ const result = parser . getDatabaseOptionsFromURI ( `${ baseURI } ?&max=sdf` ) ;
91+
92+ expect ( result . poolSize ) . toBeUndefined ( ) ;
93+ expect ( result . max ) . toEqual ( 10 ) ;
94+ } ) ;
95+
96+ it ( 'max should take precedence over poolSize' , ( ) => {
97+ const result = parser . getDatabaseOptionsFromURI ( `${ baseURI } ?poolSize=20&max=12` ) ;
98+
99+ expect ( result . poolSize ) . toBeUndefined ( ) ;
100+ expect ( result . max ) . toEqual ( 12 ) ;
87101 } ) ;
88102} ) ;
0 commit comments