Unirep-Social
Unirep-Social copied to clipboard
Context tests for frontend
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
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
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 isTypeError: Cannot read properties of undefined (reading '_db')
because thestartSync()
function is calling the._db.findOne()
method on theuserState
property. So, what I am thinking for this is that I have to initialize the userState withnew 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 😣