-
Notifications
You must be signed in to change notification settings - Fork 73
Open
Milestone
Description
Context / Problem
We recently added new JSON-RPC methods for PRT dispute data, but the internal/jsonrpc package does not yet have unit tests covering them. Existing JSON-RPC methods are already being tested; only the new ones are missing coverage.
Methods to cover:
cartesi_getTournamentcartesi_listTournamentscartesi_getCommitmentcartesi_listCommitmentscartesi_getMatchcartesi_listMatchescartesi_getMatchAdvancedcartesi_listMatchAdvances
Scope
Add unit tests in the internal/jsonrpc package to validate:
- request parsing (params decoding and validation)
- repository interaction (correct repo method called with expected arguments)
- response shape and error mapping (not found, invalid params, internal errors)
Out of scope:
- changing method semantics or response formats
Deliverables
- Add unit tests for each method listed above.
- Add/extend repository mocks/fakes used by
internal/jsonrpctests to support tournaments/commitments/matches/match_advances queries. - Ensure tests cover at least:
- happy path (single get / list)
- pagination path for list methods (when applicable)
- invalid params (missing required param, malformed hex/uint, invalid address/name)
- not found behavior for
get*methods - repository error propagation mapped to JSON-RPC errors
Acceptance criteria
- All listed methods have unit test coverage in
internal/jsonrpc(or the package where JSON-RPC handlers live). - Each
get*method test includes:- success response
- not found response
- invalid params response
- Each
list*method test includes:- success response
- pagination arguments passed through correctly (limit/offset, or equivalent)
- invalid params response
- Tests assert the JSON-RPC response structure (result vs error) and error codes/messages follow the project conventions.
-
make testpasses.
Notes
- Prefer mirroring the style/patterns used by existing JSON-RPC handler tests in this repo (same helpers, same mock style, same error assertions).
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
No status