@@ -461,15 +461,9 @@ describe('DatabaseResolver', function () {
461461 } )
462462
463463 describe ( 'parsePostgresConnectionString' , function ( ) {
464- let databaseResolver : DatabaseResolver
465464 let env : typeof process . env
466- let config : Config
467- let heroku : APIClient
468465
469466 beforeEach ( async function ( ) {
470- config = await Config . load ( )
471- heroku = new APIClient ( config )
472- databaseResolver = new DatabaseResolver ( heroku )
473467 env = process . env
474468 } )
475469
@@ -480,7 +474,7 @@ describe('DatabaseResolver', function () {
480474 describe ( 'when parsing full PostgreSQL connection strings' , function ( ) {
481475 it ( 'parses a complete PostgreSQL connection string with all components' , function ( ) {
482476 const connString = 'postgres://user1:[email protected] :5432/database1' 483- const result = databaseResolver . parsePostgresConnectionString ( connString )
477+ const result = DatabaseResolver . parsePostgresConnectionString ( connString )
484478
485479 expect ( result ) . to . deep . equal ( {
486480 database : 'database1' ,
@@ -495,7 +489,7 @@ describe('DatabaseResolver', function () {
495489
496490 it ( 'parses connection string with no port specified' , function ( ) {
497491 const connString = 'postgres://user1:[email protected] /database1' 498- const result = databaseResolver . parsePostgresConnectionString ( connString )
492+ const result = DatabaseResolver . parsePostgresConnectionString ( connString )
499493
500494 expect ( result ) . to . deep . equal ( {
501495 database : 'database1' ,
@@ -510,7 +504,7 @@ describe('DatabaseResolver', function () {
510504
511505 it ( 'parses connection string with custom port' , function ( ) {
512506 const connString = 'postgres://user1:[email protected] :5433/database1' 513- const result = databaseResolver . parsePostgresConnectionString ( connString )
507+ const result = DatabaseResolver . parsePostgresConnectionString ( connString )
514508
515509 expect ( result ) . to . deep . equal ( {
516510 database : 'database1' ,
@@ -527,7 +521,7 @@ describe('DatabaseResolver', function () {
527521 describe ( 'when parsing database names (without connection string format)' , function ( ) {
528522 it ( 'converts database name to full connection string format' , function ( ) {
529523 const dbName = 'my_database'
530- const result = databaseResolver . parsePostgresConnectionString ( dbName )
524+ const result = DatabaseResolver . parsePostgresConnectionString ( dbName )
531525
532526 expect ( result ) . to . deep . equal ( {
533527 database : 'my_database' ,
@@ -547,7 +541,7 @@ describe('DatabaseResolver', function () {
547541 PGPORT : '5433' ,
548542 }
549543 const connString = 'postgres://user1:[email protected] /database1' 550- const result = databaseResolver . parsePostgresConnectionString ( connString )
544+ const result = DatabaseResolver . parsePostgresConnectionString ( connString )
551545
552546 expect ( result . port ) . to . equal ( '5433' )
553547 } )
@@ -557,7 +551,7 @@ describe('DatabaseResolver', function () {
557551 PGPORT : '5433' ,
558552 }
559553 const dbName = 'my_database'
560- const result = databaseResolver . parsePostgresConnectionString ( dbName )
554+ const result = DatabaseResolver . parsePostgresConnectionString ( dbName )
561555
562556 expect ( result . port ) . to . equal ( '5433' )
563557 } )
@@ -567,7 +561,7 @@ describe('DatabaseResolver', function () {
567561 PGPORT : '5433' ,
568562 }
569563 const connString = 'postgres://user1:[email protected] :5434/database1' 570- const result = databaseResolver . parsePostgresConnectionString ( connString )
564+ const result = DatabaseResolver . parsePostgresConnectionString ( connString )
571565
572566 expect ( result . port ) . to . equal ( '5434' )
573567 } )
@@ -577,7 +571,7 @@ describe('DatabaseResolver', function () {
577571 PGPORT : '5433' ,
578572 }
579573 const dbName = 'my_database'
580- const result = databaseResolver . parsePostgresConnectionString ( dbName )
574+ const result = DatabaseResolver . parsePostgresConnectionString ( dbName )
581575
582576 expect ( result . port ) . to . equal ( '5433' )
583577 } )
@@ -587,23 +581,23 @@ describe('DatabaseResolver', function () {
587581 it ( 'uses default port 5432 when no port is specified in connection string' , function ( ) {
588582 process . env = { }
589583 const connString = 'postgres://user1:[email protected] /database1' 590- const result = databaseResolver . parsePostgresConnectionString ( connString )
584+ const result = DatabaseResolver . parsePostgresConnectionString ( connString )
591585
592586 expect ( result . port ) . to . equal ( '5432' )
593587 } )
594588
595589 it ( 'doesn\'t set a port when parsing database name without connection string' , function ( ) {
596590 process . env = { }
597591 const dbName = 'my_database'
598- const result = databaseResolver . parsePostgresConnectionString ( dbName )
592+ const result = DatabaseResolver . parsePostgresConnectionString ( dbName )
599593
600594 expect ( result . port ) . to . equal ( '' )
601595 } )
602596
603597 it ( 'doesn\'t set a port when connection string has no port and no hostname' , function ( ) {
604598 process . env = { }
605599 const dbName = 'my_database'
606- const result = databaseResolver . parsePostgresConnectionString ( dbName )
600+ const result = DatabaseResolver . parsePostgresConnectionString ( dbName )
607601
608602 expect ( result . port ) . to . equal ( '' )
609603 } )
0 commit comments