Documentation
¶
Index ¶
- type ClientMock
- func (mock *ClientMock) Close()
- func (mock *ClientMock) CloseCalls() []struct{}
- func (mock *ClientMock) HeaderByNumber(ctx context.Context, number *big.Int) (*rpc.Header, error)
- func (mock *ClientMock) HeaderByNumberCalls() []struct{ ... }
- func (mock *ClientMock) IsFinalized(ctx context.Context, conf uint64, txReceipt *types.Receipt) (bool, error)
- func (mock *ClientMock) IsFinalizedCalls() []struct{ ... }
- func (mock *ClientMock) TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)
- func (mock *ClientMock) TransactionReceiptCalls() []struct{ ... }
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClientMock ¶
type ClientMock struct { // CloseFunc mocks the Close method. CloseFunc func() // HeaderByNumberFunc mocks the HeaderByNumber method. HeaderByNumberFunc func(ctx context.Context, number *big.Int) (*rpc.Header, error) // IsFinalizedFunc mocks the IsFinalized method. IsFinalizedFunc func(ctx context.Context, conf uint64, txReceipt *types.Receipt) (bool, error) // TransactionReceiptFunc mocks the TransactionReceipt method. TransactionReceiptFunc func(ctx context.Context, txHash common.Hash) (*types.Receipt, error) // contains filtered or unexported fields }
ClientMock is a mock implementation of rpc.Client.
func TestSomethingThatUsesClient(t *testing.T) { // make and configure a mocked rpc.Client mockedClient := &ClientMock{ CloseFunc: func() { panic("mock out the Close method") }, HeaderByNumberFunc: func(ctx context.Context, number *big.Int) (*rpc.Header, error) { panic("mock out the HeaderByNumber method") }, IsFinalizedFunc: func(ctx context.Context, conf uint64, txReceipt *types.Receipt) (bool, error) { panic("mock out the IsFinalized method") }, TransactionReceiptFunc: func(ctx context.Context, txHash common.Hash) (*types.Receipt, error) { panic("mock out the TransactionReceipt method") }, } // use mockedClient in code that requires rpc.Client // and then make assertions. }
func (*ClientMock) CloseCalls ¶
func (mock *ClientMock) CloseCalls() []struct { }
CloseCalls gets all the calls that were made to Close. Check the length with:
len(mockedClient.CloseCalls())
func (*ClientMock) HeaderByNumber ¶ added in v0.26.4
HeaderByNumber calls HeaderByNumberFunc.
func (*ClientMock) HeaderByNumberCalls ¶ added in v0.26.4
func (mock *ClientMock) HeaderByNumberCalls() []struct { Ctx context.Context Number *big.Int }
HeaderByNumberCalls gets all the calls that were made to HeaderByNumber. Check the length with:
len(mockedClient.HeaderByNumberCalls())
func (*ClientMock) IsFinalized ¶ added in v0.26.4
func (mock *ClientMock) IsFinalized(ctx context.Context, conf uint64, txReceipt *types.Receipt) (bool, error)
IsFinalized calls IsFinalizedFunc.
func (*ClientMock) IsFinalizedCalls ¶ added in v0.26.4
func (mock *ClientMock) IsFinalizedCalls() []struct { Ctx context.Context Conf uint64 TxReceipt *types.Receipt }
IsFinalizedCalls gets all the calls that were made to IsFinalized. Check the length with:
len(mockedClient.IsFinalizedCalls())
func (*ClientMock) TransactionReceipt ¶
func (mock *ClientMock) TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)
TransactionReceipt calls TransactionReceiptFunc.
func (*ClientMock) TransactionReceiptCalls ¶
func (mock *ClientMock) TransactionReceiptCalls() []struct { Ctx context.Context TxHash common.Hash }
TransactionReceiptCalls gets all the calls that were made to TransactionReceipt. Check the length with:
len(mockedClient.TransactionReceiptCalls())
Click to show internal directories.
Click to hide internal directories.