@@ -370,6 +370,64 @@ describe('CompileFunctions', () => {
370370 } ) ;
371371 } ) ;
372372
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+
373431 it ( 'should set the environment variables based on the function configuration' , ( ) => {
374432 googlePackage . serverless . service . functions = {
375433 func1 : {
@@ -378,7 +436,6 @@ describe('CompileFunctions', () => {
378436 TEST_VAR : 'test' ,
379437 INT_VAR : 1 ,
380438 FLOAT_VAR : 3.141 ,
381- BOOL_VAR : true ,
382439 } ,
383440 events : [ { http : 'foo' } ] ,
384441 } ,
@@ -398,7 +455,6 @@ describe('CompileFunctions', () => {
398455 TEST_VAR : 'test' ,
399456 INT_VAR : '1' ,
400457 FLOAT_VAR : '3.141' ,
401- BOOL_VAR : 'true' ,
402458 } ,
403459 timeout : '60s' ,
404460 sourceArchiveUrl : 'gs://sls-my-service-dev-12345678/some-path/artifact.zip' ,
@@ -429,7 +485,6 @@ describe('CompileFunctions', () => {
429485 TEST_VAR : 'test' ,
430486 INT_VAR : 1 ,
431487 FLOAT_VAR : 3.141 ,
432- BOOL_VAR : true ,
433488 } ;
434489
435490 const compiledResources = [
@@ -446,7 +501,6 @@ describe('CompileFunctions', () => {
446501 TEST_VAR : 'test' ,
447502 INT_VAR : '1' ,
448503 FLOAT_VAR : '3.141' ,
449- BOOL_VAR : 'true' ,
450504 } ,
451505 timeout : '60s' ,
452506 sourceArchiveUrl : 'gs://sls-my-service-dev-12345678/some-path/artifact.zip' ,
@@ -473,15 +527,13 @@ describe('CompileFunctions', () => {
473527 environment : {
474528 TEST_VAR : 'test_var' ,
475529 TEST_VALUE : 'foobar' ,
476- TEST_BOOL : true ,
477530 } ,
478531 events : [ { http : 'foo' } ] ,
479532 } ,
480533 } ;
481534 googlePackage . serverless . service . provider . environment = {
482535 TEST_VAR : 'test' ,
483536 TEST_FOO : 'foo' ,
484- TEST_BOOL : false ,
485537 } ;
486538
487539 const compiledResources = [
@@ -498,7 +550,6 @@ describe('CompileFunctions', () => {
498550 TEST_VAR : 'test_var' ,
499551 TEST_VALUE : 'foobar' ,
500552 TEST_FOO : 'foo' ,
501- TEST_BOOL : 'true' ,
502553 } ,
503554 timeout : '60s' ,
504555 sourceArchiveUrl : 'gs://sls-my-service-dev-12345678/some-path/artifact.zip' ,
@@ -518,7 +569,6 @@ describe('CompileFunctions', () => {
518569 expect ( googlePackage . serverless . service . provider . environment ) . toEqual ( {
519570 TEST_VAR : 'test' ,
520571 TEST_FOO : 'foo' ,
521- TEST_BOOL : false ,
522572 } ) ;
523573 } ) ;
524574 } ) ;
0 commit comments