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

Context tests for frontend #148

Draft
wants to merge 21 commits into
base: main
Choose a base branch
from
Draft

Conversation

AnthonyMadia
Copy link
Contributor

Pull request checklist

Please check if your PR fulfills the following requirements:

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been reviewed and added / updated if needed (for bug fixes / features)
  • Build (yarn build) was run locally and any changes were pushed
  • Lint (yarn lint --check) has passed locally and any fixes were made for failures

Pull request type

Please check the type of change your PR introduces:

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe):
    Context testing in frontend

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this introduce a breaking change?

  • Yes
  • No

Other information

@AnthonyMadia
Copy link
Contributor Author

This PR is WIP but wanted to get some feedback before adding more tests I have locally.

Specifically, I would like some feedback on how to get this test passing on the User class. Do I have to mock a provider? The test throws an ethers error and not sure how to mock this.

Secondarily, how would I set up the startSync() test? The error I get is TypeError: Cannot read properties of undefined (reading '_db') because the startSync() function is calling the ._db.findOne() method on the userState property. So, what I am thinking for this is that I have to initialize the userState with new SocialUserState(), but I tried this and got the same error.
@vimwitch @kittybest

@kittybest
Copy link
Contributor

This PR is WIP but wanted to get some feedback before adding more tests I have locally.

Specifically, I would like some feedback on how to get this test passing on the User class. Do I have to mock a provider? The test throws an ethers error and not sure how to mock this.

Secondarily, how would I set up the startSync() test? The error I get is TypeError: Cannot read properties of undefined (reading '_db') because the startSync() function is calling the ._db.findOne() method on the userState property. So, what I am thinking for this is that I have to initialize the userState with new SocialUserState(), but I tried this and got the same error. @vimwitch @kittybest

I haven't done this kind of tests before... I also have to try and collect information from google, sorry not giving much help 😣

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.

Add test coverage for Context classes in frontend
2 participants