1- return ;
21var helper = require ( './test-helper' ) ;
32var Client = helper . Client ;
43
4+ var suite = new helper . Suite ( ) ;
5+
56var conInfo = helper . config ;
67
78function getConInfo ( override ) {
@@ -26,34 +27,37 @@ function getAppName(conf, cb) {
2627 } ) ) ;
2728}
2829
29- test ( 'No default appliation_name ' , function ( ) {
30+ suite . test ( 'No default appliation_name ' , function ( done ) {
3031 var conf = getConInfo ( ) ;
31- getAppName ( conf , function ( res ) {
32+ getAppName ( { } , function ( res ) {
3233 assert . strictEqual ( res , '' ) ;
34+ done ( )
3335 } ) ;
3436} ) ;
3537
36- test ( 'fallback_application_name is used' , function ( ) {
38+ suite . test ( 'fallback_application_name is used' , function ( done ) {
3739 var fbAppName = 'this is my app' ;
3840 var conf = getConInfo ( {
3941 'fallback_application_name' : fbAppName
4042 } ) ;
4143 getAppName ( conf , function ( res ) {
4244 assert . strictEqual ( res , fbAppName ) ;
45+ done ( )
4346 } ) ;
4447} ) ;
4548
46- test ( 'application_name is used' , function ( ) {
49+ suite . test ( 'application_name is used' , function ( done ) {
4750 var appName = 'some wired !@#$% application_name' ;
4851 var conf = getConInfo ( {
4952 'application_name' : appName
5053 } ) ;
5154 getAppName ( conf , function ( res ) {
5255 assert . strictEqual ( res , appName ) ;
56+ done ( )
5357 } ) ;
5458} ) ;
5559
56- test ( 'application_name has precedence over fallback_application_name' , function ( ) {
60+ suite . test ( 'application_name has precedence over fallback_application_name' , function ( done ) {
5761 var appName = 'some wired !@#$% application_name' ;
5862 var fbAppName = 'some other strange $$test$$ appname' ;
5963 var conf = getConInfo ( {
@@ -62,10 +66,11 @@ test('application_name has precedence over fallback_application_name', function(
6266 } ) ;
6367 getAppName ( conf , function ( res ) {
6468 assert . strictEqual ( res , appName ) ;
69+ done ( )
6570 } ) ;
6671} ) ;
6772
68- test ( 'application_name from connection string' , function ( ) {
73+ suite . test ( 'application_name from connection string' , function ( done ) {
6974 var appName = 'my app' ;
7075 var conParams = require ( __dirname + '/../../../lib/connection-parameters' ) ;
7176 var conf ;
@@ -76,21 +81,20 @@ test('application_name from connection string', function(){
7681 }
7782 getAppName ( conf , function ( res ) {
7883 assert . strictEqual ( res , appName ) ;
84+ done ( )
7985 } ) ;
8086} ) ;
8187
8288
8389
8490// TODO: make the test work for native client too
8591if ( ! helper . args . native ) {
86- test ( 'application_name is read from the env' , function ( ) {
92+ suite . test ( 'application_name is read from the env' , function ( done ) {
8793 var appName = process . env . PGAPPNAME = 'testest' ;
88- var conf = getConInfo ( {
89- 'just some bla' : 'to fool the pool'
90- } ) ;
91- getAppName ( conf , function ( res ) {
94+ getAppName ( { } , function ( res ) {
9295 delete process . env . PGAPPNAME ;
9396 assert . strictEqual ( res , appName ) ;
97+ done ( )
9498 } ) ;
9599 } ) ;
96100}
0 commit comments