Skip to content
This repository has been archived by the owner on Jun 7, 2024. It is now read-only.

🗺 Epic: unit tests for hooks in v4 #118

Open
18 of 26 tasks
ShravanSunder opened this issue Jan 3, 2022 · 0 comments
Open
18 of 26 tasks

🗺 Epic: unit tests for hooks in v4 #118

ShravanSunder opened this issue Jan 3, 2022 · 0 comments
Assignees
Labels
🗺 type.epic Epic, collection of issues

Comments

@ShravanSunder
Copy link
Member

ShravanSunder commented Jan 3, 2022

Current status

We have tests that use a wrapper with a ethers/hardhat provider and a mock connector. The connector uses sinon js for mocking. There are tests for about 9 contexts and EthersAppContext.

Overall Strategy

  • We want tests for all hooks.
  • We want to test the functions and helpers
  • useEthersContext needs tests for context key
  • We want to test hooks with update options.
    • I think choosing two hooks, useTokenBalance and useContractReader, and testing update options with that would be sufficient for tests that integrate hardhat and wrapper and the update options are being respected.
    • For other tests, we should mock useQuery or useEthersUpdater and make sure it is just getting the update options specified.
  • We should test override per hook

Hook test strategy

  • Tests for the functionality of the hook
  • Test update options: mock useQuery and useEthersUpdater to make sure it is receiving the right values
    • 3 as BlockNumberInterval
    • polling
  • If the hook has an override: We should have two test per-hook that has the override option:
    • (1) mock useEthersContext and check if it receives the key properly
    • (2) make sure the hook works with the override adaptor.
  • If hooks are useTokenBalance or useContractReader we should have full functionality of updates in addition to mocking as mentioned in the overall strategy. Test update options with that would be sufficient for tests that integrate hardhat and wrapper and the update options are being respected.

Code standards

  • follow current standards:
    • describe ('Give....')
    • test ('When xxxx; then xxx')
    • useTokenBalance is a great example!

Test issues

Add tests for Contexts

Add hook tests

Function tests

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🗺 type.epic Epic, collection of issues
Projects
Status: 🏃🏾‍♀️ In Progress
Development

No branches or pull requests

1 participant