File tree Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,8 @@ import { MockFetch } from '../test/mock_fetch.js'
88import { base64Encode , streamToString } from '../test/util.js'
99
1010import { MissingBlobsEnvironmentError } from './environment.js'
11- import { getDeployStore , getStore } from './main.js'
11+ import { getDeployStore , getStore , setEnvironmentContext } from './main.js'
12+ import { base64Decode } from './util.js'
1213
1314beforeAll ( async ( ) => {
1415 if ( semver . lt ( nodeVersion , '18.0.0' ) ) {
@@ -1700,3 +1701,25 @@ describe('Region configuration', () => {
17001701 } )
17011702 } )
17021703} )
1704+
1705+ describe ( 'setEnvironmentContext' , ( ) => {
1706+ test ( 'Injects the context object into the environment' , ( ) => {
1707+ expect ( env . NETLIFY_BLOBS_CONTEXT ) . toBeUndefined ( )
1708+
1709+ setEnvironmentContext ( {
1710+ deployID,
1711+ primaryRegion : 'us-east-1' ,
1712+ siteID,
1713+ token : apiToken ,
1714+ } )
1715+
1716+ expect ( env . NETLIFY_BLOBS_CONTEXT ) . toBeTypeOf ( 'string' )
1717+
1718+ const context = JSON . parse ( base64Decode ( env . NETLIFY_BLOBS_CONTEXT as string ) )
1719+
1720+ expect ( context . deployID ) . toBe ( deployID )
1721+ expect ( context . primaryRegion ) . toBe ( 'us-east-1' )
1722+ expect ( context . siteID ) . toBe ( siteID )
1723+ expect ( context . token ) . toBe ( apiToken )
1724+ } )
1725+ } )
Original file line number Diff line number Diff line change 1+ export { setEnvironmentContext } from './environment.ts'
12export { connectLambda } from './lambda_compat.ts'
23export { getDeployStore , getStore } from './store_factory.ts'
34export { listStores } from './store_list.ts'
You can’t perform that action at this time.
0 commit comments