@@ -1015,8 +1015,14 @@ test('should have only allowed environment variables set', async (t) => {
10151015 } ,
10161016 } )
10171017 . withEdgeFunction ( {
1018- // eslint-disable-next-line no-undef
1019- handler : ( ) => new Response ( `${ JSON . stringify ( Deno . env . toObject ( ) ) } ` ) ,
1018+ handler : ( ) => {
1019+ // eslint-disable-next-line no-undef
1020+ const fromDenoGlobal = Deno . env . toObject ( )
1021+ // eslint-disable-next-line no-undef
1022+ const fromNetlifyGlobal = Netlify . env . toObject ( )
1023+
1024+ return new Response ( `${ JSON . stringify ( { fromDenoGlobal, fromNetlifyGlobal } ) } ` )
1025+ } ,
10201026 name : 'env' ,
10211027 } )
10221028 . withContentFile ( {
@@ -1041,24 +1047,29 @@ test('should have only allowed environment variables set', async (t) => {
10411047 const response = await got ( `http://localhost:${ port } /env` ) . then ( ( edgeResponse ) =>
10421048 JSON . parse ( edgeResponse . body ) ,
10431049 )
1044- const envKeys = Object . keys ( response )
1050+ const buckets = Object . values ( response )
1051+ t . is ( buckets . length , 2 )
1052+
1053+ buckets . forEach ( ( bucket ) => {
1054+ const bucketKeys = Object . keys ( bucket )
10451055
1046- t . true ( envKeys . includes ( 'DENO_REGION' ) )
1047- t . is ( response . DENO_REGION , 'local' )
1056+ t . true ( bucketKeys . includes ( 'DENO_REGION' ) )
1057+ t . is ( bucket . DENO_REGION , 'local' )
10481058
1049- t . true ( envKeys . includes ( 'NETLIFY_DEV' ) )
1050- t . is ( response . NETLIFY_DEV , 'true' )
1059+ t . true ( bucketKeys . includes ( 'NETLIFY_DEV' ) )
1060+ t . is ( bucket . NETLIFY_DEV , 'true' )
10511061
1052- t . true ( envKeys . includes ( 'SECRET_ENV' ) )
1053- t . is ( response . SECRET_ENV , 'true' )
1062+ t . true ( bucketKeys . includes ( 'SECRET_ENV' ) )
1063+ t . is ( bucket . SECRET_ENV , 'true' )
10541064
1055- t . true ( envKeys . includes ( 'FROM_ENV' ) )
1056- t . is ( response . FROM_ENV , 'YAS' )
1065+ t . true ( bucketKeys . includes ( 'FROM_ENV' ) )
1066+ t . is ( bucket . FROM_ENV , 'YAS' )
10571067
1058- t . false ( envKeys . includes ( 'DENO_DEPLOYMENT_ID' ) )
1059- t . false ( envKeys . includes ( 'NODE_ENV' ) )
1060- t . false ( envKeys . includes ( 'DEPLOY_URL' ) )
1061- t . false ( envKeys . includes ( 'URL' ) )
1068+ t . false ( bucketKeys . includes ( 'DENO_DEPLOYMENT_ID' ) )
1069+ t . false ( bucketKeys . includes ( 'NODE_ENV' ) )
1070+ t . false ( bucketKeys . includes ( 'DEPLOY_URL' ) )
1071+ t . false ( bucketKeys . includes ( 'URL' ) )
1072+ } )
10621073 } ,
10631074 )
10641075 } )
0 commit comments