Skip to content

fix: migrate tests to V7#14776

Closed
osama-rizk wants to merge 27 commits into
poc/bobbor/v7from
v7/update-unit-tests
Closed

fix: migrate tests to V7#14776
osama-rizk wants to merge 27 commits into
poc/bobbor/v7from
v7/update-unit-tests

Conversation

@osama-rizk
Copy link
Copy Markdown
Contributor

@osama-rizk osama-rizk commented Apr 10, 2026

Description of changes

Migrates all test and source files to the V7 AmplifyContext pattern, replacing the removed Amplify
singleton.

Changes applied across all packages:

  • Replaced all singleton usage (Amplify.configure(), Amplify.getConfig(),
    Amplify.Auth.fetchAuthSession()) with AmplifyContext — config and auth methods now live directly on
    the context object
  • Updated API function signatures from fn(input)fn(ctx, input) to pass context as first argument
  • Removed imports for deleted exports: Amplify, AmplifyClassV6, GraphQLAPI,
    generateClientWithAmplifyInstance, getAmplifyServerContext
  • Added createMockAmplifyContext() helper (__tests__/testUtils/mockAmplifyContext.ts) to 11 packages:
    analytics, api, api-graphql, api-rest, datastore, datastore-storage-adapter, geo, interactions,
    notifications, predictions, pubsub, storage

Tests relocated (adapter-core logic moved to aws-amplify):

Deleted from adapter-nextjs Added to aws-amplify/adapterCore
origin.test.ts origin.test.ts
serializeCookie.test.ts cookie/serializeCookie.test.ts
ensureEncodedForJSCookie.test.ts (covered by serializeCookie)
createTokenValidator.test.ts createTokenValidator.test.ts
globalSettings.test.ts globalSettings.test.ts
isValidCognitoToken.test.ts isValidCognitoToken.test.ts

Tests deleted (modules removed in V7):

  • aws-amplify/__tests__/initSingleton.test.tsAmplify singleton no longer exists
  • api-graphql/__tests__/internals/server/generateClientWithAmplifyInstance.test.ts — server client
    factory removed
  • api-rest/__tests__/server.test.ts — server REST APIs removed
  • storage/__tests__/providers/s3/apis/server/ (5 files) — server storage APIs removed

Tests added:

  • adapter-express/__tests__/utils/createCookieStorageAdapterFromExpressContext.test.ts
  • aws-amplify/__tests__/adapterCore/createServerRunner.test.ts

Issue #, if available

Part of V7 AmplifyContext migration (poc/bobbor/v7)

Description of how you validated changes

  • Ran npx jest --no-coverage in each package individually — all suites pass
  • Ran npx eslint on packages with source changes — lint clean

Checklist

  • PR description included
  • yarn test passes
  • Unit Tests are changed or
    added
  • Relevant documentation is changed or added (and PR referenced)

Checklist for repo maintainers

  • Verify E2E tests for existing workflows are working as expected or add E2E tests for newly added
    workflows
  • New source file paths included in this PR have been added to CODEOWNERS, if appropriate

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

bobbor and others added 20 commits March 27, 2026 15:33
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.23 to 4.18.1.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](lodash/lodash@4.17.23...4.18.1)

---
updated-dependencies:
- dependency-name: lodash
  dependency-version: 4.18.1
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
- Remove duplicate test 'should include expectedBucketOwner for PUT with path'
- Improve JSDoc on method field explaining PUT vs GET behavior
- Add tests for credential expiration and expiresIn for PUT method
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 10, 2026

⚠️ No Changeset found

Latest commit: e54e49e

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@osama-rizk osama-rizk changed the title fix: migrate tests to V7 AmplifyContext pattern across all packages fix: migrate tests to V7 Apr 13, 2026
@bobbor bobbor force-pushed the poc/bobbor/v7 branch 3 times, most recently from fb3e3a8 to 7d6f244 Compare April 23, 2026 12:46
@bobbor
Copy link
Copy Markdown
Member

bobbor commented May 4, 2026

I think we can close this in favor of #14786

wdyt?

@osama-rizk osama-rizk closed this May 4, 2026
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.

4 participants