Unirep-Social icon indicating copy to clipboard operation
Unirep-Social copied to clipboard

Context tests for frontend

Open AnthonyMadia opened this issue 2 years ago • 2 comments

Pull request checklist

Please check if your PR fulfills the following requirements:

  • [x] 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
  • [x] 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 avatar Nov 02 '22 14:11 AnthonyMadia

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

AnthonyMadia avatar Nov 03 '22 15:11 AnthonyMadia

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 😣

kittybest avatar Nov 11 '22 12:11 kittybest