forked from 0xPolygon/polygon-edge
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Uniform jsonrpc type return (0xPolygon#873)
* Use uniform type return in jsonrpc * Revert * Fix error convetion * Fix tests
- Loading branch information
Showing
9 changed files
with
55 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package jsonrpc | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/hashicorp/go-hclog" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestNetEndpoint_PeerCount(t *testing.T) { | ||
dispatcher := newDispatcher( | ||
hclog.NewNullLogger(), | ||
newMockStore(), | ||
&dispatcherParams{ | ||
chainID: 1, | ||
}) | ||
|
||
resp, err := dispatcher.Handle([]byte(`{ | ||
"method": "net_peerCount", | ||
"params": [""] | ||
}`)) | ||
assert.NoError(t, err) | ||
|
||
var res string | ||
|
||
assert.NoError(t, expectJSONResult(resp, &res)) | ||
assert.Equal(t, "0x14", res) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters