Skip to content

Passwordless redirect unit test#2235

Merged
hajinsuha1 merged 3 commits intoW-17550783-passwordless-login-redirectfrom
passwordless-redirect-unit-test
Feb 3, 2025
Merged

Passwordless redirect unit test#2235
hajinsuha1 merged 3 commits intoW-17550783-passwordless-login-redirectfrom
passwordless-redirect-unit-test

Conversation

@hajinsuha1
Copy link
Collaborator

Description

Types of Changes

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Documentation update
  • Breaking change (could cause existing functionality to not work as expected)
  • Other changes (non-breaking changes that does not fit any of the above)

Breaking changes include:

  • Removing a public function or component or prop
  • Adding a required argument to a function
  • Changing the data type of a function parameter or return value
  • Adding a new peer dependency to package.json

Changes

  • (change1)

How to Test-Drive This PR

  • (step1)

Checklists

General

  • Changes are covered by test cases
  • CHANGELOG.md updated with a short description of changes (not required for documentation updates)

Accessibility Compliance

You must check off all items in one of the follow two lists:

  • There are no changes to UI

or...

Localization

  • Changes include a UI text update in the Retail React App (which requires translation)

navigate(redirectTo)
}
}, [isRegistered])
}, [isRegistered, redirectPath])
Copy link
Collaborator Author

@hajinsuha1 hajinsuha1 Feb 3, 2025

Choose a reason for hiding this comment

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

needed to add redirectPath to the dependency array because I wasn't sure how to make isRegistered change to trigger this useEffect.

However this shouldn't change the current behaviour because redirectPath is only set when the user navigates to the /passwordless-landing-page

.mockImplementation((helperType) => mockAuthHelperFunctions[helperType]),
useCustomerBaskets: () => {return {data: mockMergedBasket, isSuccess: true}},
useCustomerType: jest.fn(() => {return {isRegistered: false, customerType: 'guest'}})
useCustomerType: jest.fn(() => {return {isRegistered: true, customerType: 'guest'}})
Copy link
Collaborator Author

@hajinsuha1 hajinsuha1 Feb 3, 2025

Choose a reason for hiding this comment

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

the other way of doing this is by mocking the /passwordless/token api using global.server.use but because of the /jwks validation I was having issues. So instead I just mocked that the user isRegistered

@hajinsuha1 hajinsuha1 marked this pull request as ready for review February 3, 2025 16:51
@hajinsuha1 hajinsuha1 requested a review from a team as a code owner February 3, 2025 16:51
@hajinsuha1 hajinsuha1 requested a review from yunakim714 February 3, 2025 16:51
@hajinsuha1 hajinsuha1 merged commit 73f6482 into W-17550783-passwordless-login-redirect Feb 3, 2025
8 of 9 checks passed
@hajinsuha1 hajinsuha1 deleted the passwordless-redirect-unit-test branch February 3, 2025 16:57
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