Skip to content

Context tests for frontend#148

Draft
AnthonyMadia wants to merge 21 commits intomainfrom
frontend/context-testing
Draft

Context tests for frontend#148
AnthonyMadia wants to merge 21 commits intomainfrom
frontend/context-testing

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