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

add mock response to test json rpc errors #2396

Merged
merged 2 commits into from
May 6, 2023

Conversation

mdtanrikulu
Copy link
Contributor

@mdtanrikulu mdtanrikulu commented May 2, 2023

Motivation

The goal is to be able to test any json-rpc errors and consequences afterwards. I needed such modification while writing test cases for a middleware.

Solution

  • Added new enum called MockResponse, instead of passing the Value, now we pass this enum as a response type.
  • MockProvider now checks the response types with match and treats accordingly.
  • new fn called push_response helps pushing the JsonRpcError as the next response.

PR Checklist

  • Added Tests
  • Added Documentation
  • Breaking changes

Copy link
Collaborator

@DaniPopes DaniPopes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@DaniPopes DaniPopes merged commit e7685b3 into gakonst:master May 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants