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

Increase test coverage #489

Open
rianhughes opened this issue Dec 1, 2023 · 3 comments
Open

Increase test coverage #489

rianhughes opened this issue Dec 1, 2023 · 3 comments
Assignees
Labels
good first issue Good for newcomers

Comments

@rianhughes
Copy link
Contributor

rianhughes commented Dec 1, 2023

This issue outlines how external contributors could really help out the starknet.go package by helping to increase the test coverage for starknet.go's rpc package. See the readme for the list of starknet methods. I would also recommend looking at existing test cases for help.

A good approach would be to start with the read methods (those that don't require gas/fee tokens, eg, getTransactionByHash, starknet_getBlockWithTxs, etc), and with mock environments (doesn't require starknet endpoint). Only once you are very comfortable working with these would I recommend starting to work on devnet environments, and then testnet/mainnet environments.

If you are interested in starting a new issue please:

  1. Create a new issue outlining which (method,environment) you would like to work on. Eg "Increase test coverage of (starknet_getNonce, mock)". Adding comments in the issue can help reviews.
  2. Fork the repo, or create a new branch
  3. Implement test cases for that method
  4. When all github tests pass on your branch, create a PR, linking to the original issue you created.
  5. Request a review

Ideally we should test successful requests (eg getTransactionByHash with a valid hash), and failing requests (eg getTransactionByHash with an invalid hash). And if a method can work with multiple argument types (eg AddInvokeTranscation accepts BroadcastInvokev0Txn, and BroadcastInvokev1Txn, so we should test both of these etc.), we should also add a test case for that.

To run the tests in the rpc package:

  1. Enter the directory
  2. run "go test . -env mock -v". Currently we test mock, devnet, testnet and mainnet environments (although a lot of these are empty tests)
@rianhughes rianhughes self-assigned this Dec 1, 2023
@rianhughes rianhughes added the good first issue Good for newcomers label Dec 1, 2023
@AryanGodara
Copy link
Contributor

@rianhughes, I see this one has been open for some time.
I have good experience working with Go in distributed systems; and most of it has been writing test suites 😅.
Is it okay if I take up this issue, and start working on it? I see you've been doing the heavy lifting with the recent PRs, and I would love to be able to contribute :D

@Sean-Hughes
Copy link

@rianhughes Nice work! I'd also love to contribute and learning more about Starknet. Is it okay if I also take a look at this issue? Appreciate the work you've been doing on this recently and I would love to contribute in some way as well.

@kenquiros64
Copy link

@rianhughes Great description! Is there is any chance to contribute in this issue. I would love to work on it. Let me know

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
Status: No status
Development

No branches or pull requests

4 participants