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

Double Login Tests #6294

Merged
merged 2 commits into from
Dec 4, 2023
Merged

Double Login Tests #6294

merged 2 commits into from
Dec 4, 2023

Conversation

takameyer
Copy link
Contributor

@takameyer takameyer commented Dec 1, 2023

What, How & Why?

  • I wanted to ensure the double login tests would pass for realm-react.
  • Everything works as they should and now we have a basic UserProvider test.
  • Still can't reproduce the original issue that we are seeing in React Native.
  • Making a PR as they expand the tests a bit further and get a start to the UserProvider tests.

To the reviewer

  • I do not need a deep review here, just wanted to make sure this code lives somewhere while I continue to debug a related issue.
  • Had hoped these tests would help reproduce the issue outside of React Native, but sadly they pass.

☑️ ToDos

  • 📝 Changelog entry
  • 📝 Compatibility label is updated or copied from previous entry
  • 📝 Update COMPATIBILITY.md
  • 🚦 Tests
  • 📦 Updated internal package version in consuming package.jsons (if updating internal packages)
  • 📱 Check the React Native/other sample apps work if necessary
  • 💥 Breaking label has been applied or is not necessary

* I wanted to ensure the double login tests would pass for realm-react.
* Everything works as they should and now we have a basic UserProvider test.
Copy link

Coverage Status

coverage: 86.182%. remained the same
when pulling 845b4f0 on andrew/double-login
into d315db1 on main.

Comment on lines 103 to 108
console.log("testing results: ", {
id,
currentId: realmApp?.currentUser?.id,
refreshToken,
currentRefreshToken: realmApp?.currentUser?.refreshToken,
});
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
console.log("testing results: ", {
id,
currentId: realmApp?.currentUser?.id,
refreshToken,
currentRefreshToken: realmApp?.currentUser?.refreshToken,
});


useEffect(() => {
if (isUserRegistered && !result.pending && result.operation !== AuthOperationName.LogInWithEmailPassword) {
console.log("logging in user");
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
console.log("logging in user");


useEffect(() => {
if (result.success && result.operation === AuthOperationName.Register) {
console.log("user registered");
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
console.log("user registered");


useEffect(() => {
if (!isUserRegistered && !result.pending && result.operation !== AuthOperationName.Register) {
console.log("registering user");
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
console.log("registering user");

Copy link
Member

@kraenhansen kraenhansen left a comment

Choose a reason for hiding this comment

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

If you don't want to remove the console.log statements, you could use the debug package instead.

Copy link
Contributor

@elle-j elle-j left a comment

Choose a reason for hiding this comment

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

Nice getting these underway 🥳 🙏

@takameyer takameyer force-pushed the andrew/double-login branch from d3bf5c6 to 3c61eff Compare December 4, 2023 08:02
@takameyer takameyer merged commit ca6abdd into main Dec 4, 2023
@takameyer takameyer deleted the andrew/double-login branch December 4, 2023 08:03
bimusiek pushed a commit to bimusiek/realm-js that referenced this pull request Mar 14, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants