@@ -22,15 +22,19 @@ process.env.TEST_GETENV_STRING_ARRAY2 = 'one, two ,three , four';
2222process . env . TEST_GETENV_STRING_ARRAY3 = 'one, two,' ;
2323process . env . TEST_GETENV_STRING_ARRAY4 = ' ' ;
2424process . env . TEST_GETENV_STRING_ARRAY5 = 'one;two:three,four' ;
25+ process . env . TEST_GETENV_STRING_ARRAY6 = 'one two ' ;
2526process . env . TEST_GETENV_INT_ARRAY = '1,2, 3' ;
27+ process . env . TEST_GETENV_INT_ARRAY2 = '1 2 3' ;
2628process . env . TEST_GETENV_INT_ARRAY_INVALID1 = '1, 2.2, 3' ;
2729process . env . TEST_GETENV_INT_ARRAY_INVALID2 = '1, true, 3' ;
2830process . env . TEST_GETENV_INT_ARRAY_INVALID3 = '1, abc, 3' ;
2931process . env . TEST_GETENV_FLOAT_ARRAY = '1.9,2, 3e5' ;
32+ process . env . TEST_GETENV_FLOAT_ARRAY2 = '1.9 2 3e5' ;
3033process . env . TEST_GETENV_FLOAT_ARRAY_INVALID1 = '1.9,true, 3e5' ;
3134process . env . TEST_GETENV_FLOAT_ARRAY_INVALID2 = '1.9, abc, 3e5' ;
3235process . env . TEST_GETENV_FLOAT_ARRAY_INVALID3 = '1.9, Infinity, 3e5' ;
3336process . env . TEST_GETENV_BOOL_ARRAY = 'true, false, true' ;
37+ process . env . TEST_GETENV_BOOL_ARRAY2 = 'true false true' ;
3438process . env . TEST_GETENV_BOOL_ARRAY_INVALID1 = 'true, 1, true' ;
3539process . env . TEST_GETENV_BOOL_ARRAY_INVALID2 = 'true, 1.2, true' ;
3640process . env . TEST_GETENV_BOOL_ARRAY_INVALID3 = 'true, abc, true' ;
@@ -303,7 +307,37 @@ tests['getenv.array() valid string (default) input'] = function() {
303307
304308 data . forEach ( function ( item ) {
305309 const arrayVar = getenv . array ( item . varName ) ;
306- assert . deepEqual ( arrayVar , item . expected ) ;
310+ assert . deepStrictEqual ( arrayVar , item . expected ) ;
311+ } ) ;
312+ } ;
313+
314+ tests [ 'getenv.array() valid inputs split by separator' ] = function ( ) {
315+ const data = [
316+ {
317+ varName : 'TEST_GETENV_STRING_ARRAY6' ,
318+ type : 'string' ,
319+ expected : [ 'one' , 'two' , '' ] ,
320+ } ,
321+ {
322+ varName : 'TEST_GETENV_INT_ARRAY2' ,
323+ type : 'int' ,
324+ expected : [ 1 , 2 , 3 ] ,
325+ } ,
326+ {
327+ varName : 'TEST_GETENV_FLOAT_ARRAY2' ,
328+ type : 'float' ,
329+ expected : [ 1.9 , 2 , 3e5 ] ,
330+ } ,
331+ {
332+ varName : 'TEST_GETENV_BOOL_ARRAY2' ,
333+ type : 'boolish' ,
334+ expected : [ true , false , true ] ,
335+ } ,
336+ ] ;
337+
338+ data . forEach ( function ( item ) {
339+ const arrayVar = getenv . array ( item . varName , item . type , [ ] , / \s + / ) ;
340+ assert . deepStrictEqual ( arrayVar , item . expected ) ;
307341 } ) ;
308342} ;
309343
@@ -411,7 +445,7 @@ tests['getenv.array() nonexistent variable'] = function() {
411445tests [ 'getenv.array() nonexistent variable with fallback' ] = function ( ) {
412446 const expect = [ 'A' , 'B' , 'C' ] ;
413447 const arrayVar = getenv . array ( 'TEST_GETENV_NONEXISTENT' , 'string' , expect ) ;
414- assert . deepEqual ( arrayVar , expect ) ;
448+ assert . deepStrictEqual ( arrayVar , expect ) ;
415449} ;
416450
417451tests [ 'getenv.array() nonexistent type' ] = function ( ) {
@@ -428,7 +462,7 @@ tests['getenv.multi([string]) multiple env vars'] = function() {
428462 const expect = {
429463 foo : process . env . TEST_GETENV_STRING ,
430464 } ;
431- assert . deepEqual ( expect , config ) ;
465+ assert . deepStrictEqual ( expect , config ) ;
432466} ;
433467
434468tests [ 'getenv([string]) multiple env vars shortcut' ] = function ( ) {
@@ -439,7 +473,7 @@ tests['getenv([string]) multiple env vars shortcut'] = function() {
439473 const expect = {
440474 foo : process . env . TEST_GETENV_STRING ,
441475 } ;
442- assert . deepEqual ( expect , config ) ;
476+ assert . deepStrictEqual ( expect , config ) ;
443477} ;
444478
445479tests [ 'getenv.multi([string/throw]) multiple env vars' ] = function ( ) {
@@ -459,7 +493,7 @@ tests['getenv.multi([string/typecast]) multiple env vars'] = function() {
459493 const expect = {
460494 foo : process . env . TEST_GETENV_STRING ,
461495 } ;
462- assert . deepEqual ( expect , config ) ;
496+ assert . deepStrictEqual ( expect , config ) ;
463497} ;
464498
465499tests [ 'getenv.multi([string/typecast/defaultval]) multiple env vars' ] = function ( ) {
@@ -470,7 +504,7 @@ tests['getenv.multi([string/typecast/defaultval]) multiple env vars'] = function
470504 const expect = {
471505 foo : 'default' ,
472506 } ;
473- assert . deepEqual ( expect , config ) ;
507+ assert . deepStrictEqual ( expect , config ) ;
474508} ;
475509
476510tests [ 'getenv.multi([string/typecast/throw]) multiple env vars' ] = function ( ) {
@@ -490,7 +524,7 @@ tests['getenv.multi([string/defaultval]) multiple env vars'] = function() {
490524 const expect = {
491525 foo : process . env . TEST_GETENV_STRING ,
492526 } ;
493- assert . deepEqual ( expect , config ) ;
527+ assert . deepStrictEqual ( expect , config ) ;
494528} ;
495529
496530tests [ 'getenv.multi([string/defaultval/throw]) multiple env vars' ] = function ( ) {
@@ -501,7 +535,7 @@ tests['getenv.multi([string/defaultval/throw]) multiple env vars'] = function()
501535 const expect = {
502536 foo : 'default' ,
503537 } ;
504- assert . deepEqual ( expect , config ) ;
538+ assert . deepStrictEqual ( expect , config ) ;
505539} ;
506540
507541tests [ 'getenv.multi([string/single]) multiple env vars' ] = function ( ) {
@@ -512,7 +546,7 @@ tests['getenv.multi([string/single]) multiple env vars'] = function() {
512546 const expect = {
513547 foo : process . env . TEST_GETENV_STRING ,
514548 } ;
515- assert . deepEqual ( expect , config ) ;
549+ assert . deepStrictEqual ( expect , config ) ;
516550} ;
517551
518552tests [ 'getenv.multi([string/single/throw]) multiple env vars' ] = function ( ) {
@@ -539,7 +573,7 @@ tests['getenv.url() valid input'] = function() {
539573 h [ key ] = parsed [ key ] ;
540574 return h ;
541575 } , { } ) ;
542- assert . deepEqual ( actual , expectation ) ;
576+ assert . deepStrictEqual ( actual , expectation ) ;
543577 } ) ;
544578} ;
545579
0 commit comments