Documentation ¶
Overview ¶
Package rpctest provides utilities for testing RPC methods.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is a fake RPC endpoint that responds only to a single requests that is definded in a golden-file.
Request golden-files have the following format to define a single request and the corresponding response:
// Comments and empty lines will be ignored. // Request starts with ">". > {"jsonrpc":"2.0","id":1,"method":"eth_chainId"} // Response starts with "<". < {"jsonrpc":"2.0","id":1,"result":"0x1"}
func NewFileServer ¶
NewFileServer returns a new instance of Server that serves the golden-file from the given filename.
type TestCase ¶
type TestCase[T any] struct { Golden string // File name in local "testdata/" directory without ".golden" extension Call w3protypes.CallerFactory[T] // Call to test GotRet T // Actual return value of the call WantRet T // Wanted return value of the call WantErr error // Wanted error of the call }
Click to show internal directories.
Click to hide internal directories.