Skip to content

test(gen2-migration): add test for post confirmation trigger in store-locator app#14834

Draft
sai-ray wants to merge 2 commits intodevfrom
sai/postconfirmation-trigger-test
Draft

test(gen2-migration): add test for post confirmation trigger in store-locator app#14834
sai-ray wants to merge 2 commits intodevfrom
sai/postconfirmation-trigger-test

Conversation

@sai-ray
Copy link
Copy Markdown
Contributor

@sai-ray sai-ray commented Apr 30, 2026

Description of changes

This PR adds a test that validates the PostConfirmation Cognito trigger for store-locator. A user who signs up and gets confirmed should land in the storeLocatorAdmin group via the migrated Lambda. The test runs at every test:gen1 and test:gen2 phase, exercising the trigger on both the Gen1 pool and the Gen2 post-refactor pool.

The trigger only fires on the real SignUp + AdminConfirmSignUp flow, which requires AllowAdminCreateUserOnly: false on the user pool. The test detects the current value, flips to false for the test run if needed, and restores the original value in afterAll.

Cognito's UpdateUserPool resets any omitted field to its default, so the test follows the AWS-documented pattern of DescribeUserPool → copy all safe fields → override just AdminCreateUserConfig.AllowAdminCreateUserOnlyUpdateUserPool to avoid clobbering unrelated pool settings.

Issue #, if available

Description of how you validated changes

  • Full e2e run on store-locator passed end-to-end: 8 invocations of tests/auth.test.ts across all test:gen1 / test:gen2 phases (pre/post sandbox and pre/post refactor), plus the existing shared-auth.test.ts at the end. No regressions to other tests.

Checklist

  • PR description included
  • yarn test passes
  • Tests are changed or added
  • Relevant documentation is changed or added (and PR referenced)
  • New AWS SDK calls or CloudFormation actions have been added to relevant test and service IAM policies
  • Pull request labels are added

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Comment thread amplify-migration-apps/store-locator/tests/auth.test.ts Fixed
Comment thread amplify-migration-apps/store-locator/tests/auth.test.ts Fixed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants