@@ -370,6 +370,64 @@ describe('CompileFunctions', () => {
370
370
} ) ;
371
371
} ) ;
372
372
373
+ it ( 'should fail setting environment variable due to unsupported type (bool)' , ( ) => {
374
+ googlePackage . serverless . service . functions = {
375
+ func1 : {
376
+ handler : 'func1' ,
377
+ environment : {
378
+ TEST_VAR : true ,
379
+ } ,
380
+ events : [ { http : 'foo' } ] ,
381
+ } ,
382
+ } ;
383
+
384
+ expect ( ( ) => googlePackage . compileFunctions ( ) ) . toThrow ( Error ) ;
385
+ } ) ;
386
+
387
+ it ( 'should fail setting environment variable due to unsupported type (null)' , ( ) => {
388
+ googlePackage . serverless . service . functions = {
389
+ func1 : {
390
+ handler : 'func1' ,
391
+ environment : {
392
+ TEST_VAR : null ,
393
+ } ,
394
+ events : [ { http : 'foo' } ] ,
395
+ } ,
396
+ } ;
397
+
398
+ expect ( ( ) => googlePackage . compileFunctions ( ) ) . toThrow ( Error ) ;
399
+ } ) ;
400
+
401
+ it ( 'should fail setting environment variable due to unsupported type (object)' , ( ) => {
402
+ googlePackage . serverless . service . functions = {
403
+ func1 : {
404
+ handler : 'func1' ,
405
+ environment : {
406
+ dev : {
407
+ TEST_VAR : 'test' ,
408
+ } ,
409
+ } ,
410
+ events : [ { http : 'foo' } ] ,
411
+ } ,
412
+ } ;
413
+
414
+ expect ( ( ) => googlePackage . compileFunctions ( ) ) . toThrow ( Error ) ;
415
+ } ) ;
416
+
417
+ it ( 'should fail setting environment variable from provider due to unsupported type (bool)' , ( ) => {
418
+ googlePackage . serverless . service . functions = {
419
+ func1 : {
420
+ handler : 'func1' ,
421
+ events : [ { http : 'foo' } ] ,
422
+ } ,
423
+ } ;
424
+ googlePackage . serverless . service . provider . environment = {
425
+ TEST_VAR : true ,
426
+ } ;
427
+
428
+ expect ( ( ) => googlePackage . compileFunctions ( ) ) . toThrow ( Error ) ;
429
+ } ) ;
430
+
373
431
it ( 'should set the environment variables based on the function configuration' , ( ) => {
374
432
googlePackage . serverless . service . functions = {
375
433
func1 : {
@@ -378,7 +436,6 @@ describe('CompileFunctions', () => {
378
436
TEST_VAR : 'test' ,
379
437
INT_VAR : 1 ,
380
438
FLOAT_VAR : 3.141 ,
381
- BOOL_VAR : true ,
382
439
} ,
383
440
events : [ { http : 'foo' } ] ,
384
441
} ,
@@ -398,7 +455,6 @@ describe('CompileFunctions', () => {
398
455
TEST_VAR : 'test' ,
399
456
INT_VAR : '1' ,
400
457
FLOAT_VAR : '3.141' ,
401
- BOOL_VAR : 'true' ,
402
458
} ,
403
459
timeout : '60s' ,
404
460
sourceArchiveUrl : 'gs://sls-my-service-dev-12345678/some-path/artifact.zip' ,
@@ -429,7 +485,6 @@ describe('CompileFunctions', () => {
429
485
TEST_VAR : 'test' ,
430
486
INT_VAR : 1 ,
431
487
FLOAT_VAR : 3.141 ,
432
- BOOL_VAR : true ,
433
488
} ;
434
489
435
490
const compiledResources = [
@@ -446,7 +501,6 @@ describe('CompileFunctions', () => {
446
501
TEST_VAR : 'test' ,
447
502
INT_VAR : '1' ,
448
503
FLOAT_VAR : '3.141' ,
449
- BOOL_VAR : 'true' ,
450
504
} ,
451
505
timeout : '60s' ,
452
506
sourceArchiveUrl : 'gs://sls-my-service-dev-12345678/some-path/artifact.zip' ,
@@ -473,15 +527,13 @@ describe('CompileFunctions', () => {
473
527
environment : {
474
528
TEST_VAR : 'test_var' ,
475
529
TEST_VALUE : 'foobar' ,
476
- TEST_BOOL : true ,
477
530
} ,
478
531
events : [ { http : 'foo' } ] ,
479
532
} ,
480
533
} ;
481
534
googlePackage . serverless . service . provider . environment = {
482
535
TEST_VAR : 'test' ,
483
536
TEST_FOO : 'foo' ,
484
- TEST_BOOL : false ,
485
537
} ;
486
538
487
539
const compiledResources = [
@@ -498,7 +550,6 @@ describe('CompileFunctions', () => {
498
550
TEST_VAR : 'test_var' ,
499
551
TEST_VALUE : 'foobar' ,
500
552
TEST_FOO : 'foo' ,
501
- TEST_BOOL : 'true' ,
502
553
} ,
503
554
timeout : '60s' ,
504
555
sourceArchiveUrl : 'gs://sls-my-service-dev-12345678/some-path/artifact.zip' ,
@@ -518,7 +569,6 @@ describe('CompileFunctions', () => {
518
569
expect ( googlePackage . serverless . service . provider . environment ) . toEqual ( {
519
570
TEST_VAR : 'test' ,
520
571
TEST_FOO : 'foo' ,
521
- TEST_BOOL : false ,
522
572
} ) ;
523
573
} ) ;
524
574
} ) ;
0 commit comments