Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add missing auto sign-in unit tests #12484

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

israx
Copy link
Member

@israx israx commented Oct 31, 2023

Description of changes

add the following tests cases for auto sign-in:

  • Auto sign-in should not resolve if a different user is confirmed
  • Auto sign-in should not be interrupted if confirmSignUp fails
  • signUp should return "COMPLETE_AUTO_SIGN_IN" step when autoSignIn is enabled with verification link.

Issue #, if available

Description of how you validated changes

yarn test

Checklist

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

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

@israx israx requested a review from a team as a code owner October 31, 2023 19:14
@israx israx changed the title chore: add missing auto sign-in tests chore: add missing auto sign-in unit tests Oct 31, 2023
autoSignIn,
resetAutoSignIn,
} from '../../../src/providers/cognito/apis/autoSignIn';
import * as clients from '../../../src/providers/cognito/utils/clients/CognitoIdentityProvider';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Super nit: this is importing a single (CognitoIdentityProvider) client, so the plural name could be misleading.

});

test('Auto sign-in should resolve to a signIn output', async () => {
const signInOutput = await autoSignIn();
expect(signInOutput).toEqual(authAPITestParams.signInResult());
expect(handleUserSRPAuthflowSpy).toBeCalledTimes(1);
});

test('Auto sign-in should not resolve if a different user is confirmed', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if this is what is being tested here. It looks like we never test auto sign-in after the first user is confirmed.

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