forked from aws-amplify/amplify-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(amplify-category-function): Storage env vars not added to lambda …
…function (aws-amplify#7785) * fix(7718) Storage env vars not added to lambda function * unit-tests Co-authored-by: Sachin Panemangalore <sachinrp@amazon.com>
- Loading branch information
Showing
7 changed files
with
81 additions
and
6 deletions.
There are no files selected for viewing
46 changes: 46 additions & 0 deletions
46
..._tests__/provider-utils/awscloudformation/service-walkthroughs/lambda-walkthrough.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { topLevelCommentPrefix, topLevelCommentSuffix, envVarPrintoutPrefix } from '../../../../constants'; | ||
import { buildTopLevelComment, buildShowEnvVars } from '../../../../provider-utils/awscloudformation/service-walkthroughs/lambda-walkthrough'; | ||
|
||
|
||
|
||
describe("Lambda Walkthrough : Advanced options and Environment Vars ", () => { | ||
test("buildTopLevelComment should insert all environment variables in top-level-comment (example code header)", () => { | ||
const inputEnvMap : Record<string, any> = { | ||
"ENV": { | ||
"Ref": "env" | ||
}, | ||
"REGION": { | ||
"Ref": "AWS::Region" | ||
}, | ||
"STORAGE_MOCK_BUCKETNAME": { | ||
"Ref": "storageMockBucketName" | ||
}, | ||
"SES_EMAIL": { | ||
"Ref": "sesEmail" | ||
} | ||
} | ||
const outputString = `${topLevelCommentPrefix}ENV\n\tREGION\n\tSTORAGE_MOCK_BUCKETNAME\n\tSES_EMAIL${topLevelCommentSuffix}` | ||
expect( buildTopLevelComment( inputEnvMap ) ).toEqual(outputString); | ||
|
||
}); | ||
|
||
test("buildShowEnvVars should insert all environment variables to be displayed", () => { | ||
const inputEnvMap : Record<string, any> = { | ||
"ENV": { | ||
"Ref": "env" | ||
}, | ||
"REGION": { | ||
"Ref": "AWS::Region" | ||
}, | ||
"STORAGE_MOCK_BUCKETNAME": { | ||
"Ref": "storageMockBucketName" | ||
}, | ||
"SES_EMAIL": { | ||
"Ref": "sesEmail" | ||
} | ||
} | ||
const outputString = `${envVarPrintoutPrefix}ENV\n\tREGION\n\tSTORAGE_MOCK_BUCKETNAME\n\tSES_EMAIL`; | ||
expect( buildShowEnvVars( inputEnvMap ) ).toEqual(outputString); | ||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
...ources/lambda/trigger/trigger-dynamodb.js → ...es/lambda/trigger/trigger-dynamodb.js.ejs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
...sources/lambda/trigger/trigger-kinesis.js → ...ces/lambda/trigger/trigger-kinesis.js.ejs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters