File tree Expand file tree Collapse file tree
packages/ddb-publisher/src/__tests__ Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -361,4 +361,44 @@ describe("runPublisher", () => {
361361 } ) ,
362362 ) . rejects . toThrow ( "status=<missing>" ) ;
363363 } ) ;
364+
365+ it ( "should use explicit AWS env values for local DynamoDB endpoints when provided" , async ( ) => {
366+ const store : LoadedConfigStore = {
367+ rootPath : "/tmp" ,
368+ records : [ ] ,
369+ } ;
370+
371+ fileStore . loadConfigStore . mockResolvedValue ( store ) ;
372+ fileStore . validateConfigStore . mockReturnValue ( { ok : true , issues : [ ] } ) ;
373+ audit . auditBeforeLoad . mockResolvedValue ( { blockingRecords : [ ] } ) ;
374+
375+ process . env . SUPPLIER_CONFIG_DDB_ENDPOINT_URL = "http://localhost:8000" ;
376+ process . env . AWS_REGION = "eu-central-1" ;
377+ process . env . AWS_ACCESS_KEY_ID = "customKey" ;
378+ process . env . AWS_SECRET_ACCESS_KEY = "customSecret" ;
379+
380+ try {
381+ await runPublisher ( {
382+ sourcePath : "/tmp" ,
383+ env : "draft" ,
384+ tableName : "tbl" ,
385+ dryRun : false ,
386+ force : false ,
387+ } ) ;
388+
389+ expect ( awsClient . DynamoDBClient ) . toHaveBeenCalledWith ( {
390+ endpoint : "http://localhost:8000" ,
391+ region : "eu-central-1" ,
392+ credentials : {
393+ accessKeyId : "customKey" ,
394+ secretAccessKey : "customSecret" ,
395+ } ,
396+ } ) ;
397+ } finally {
398+ delete process . env . SUPPLIER_CONFIG_DDB_ENDPOINT_URL ;
399+ delete process . env . AWS_REGION ;
400+ delete process . env . AWS_ACCESS_KEY_ID ;
401+ delete process . env . AWS_SECRET_ACCESS_KEY ;
402+ }
403+ } ) ;
364404} ) ;
You can’t perform that action at this time.
0 commit comments