Documentation ¶
Overview ¶
Package testdelegation provides helper functions for constructing real (e.g. localnet) and mock DelegationClient objects with pre-configured and/or parameterised call arguments, return value(s), and/or expectations thereof. Intended for use in tests.
Index ¶
- func NewAnyTimeLastNRedelegationsClient(t *testing.T, appAddress string) *mockclient.MockDelegationClient
- func NewAnyTimesRedelegation(t *testing.T, appAddress string, gatewayAddress string) *mockclient.MockRedelegation
- func NewAnyTimesRedelegationsSequence(ctx context.Context, t *testing.T, appAddress string, ...) *mockclient.MockDelegationClient
- func NewLocalnetClient(ctx context.Context, t *testing.T) client.DelegationClient
- func NewOneTimeRedelegationsSequenceDelegationClient(ctx context.Context, t *testing.T, ...) *mockclient.MockDelegationClient
- func NewRedelegationEventBytes(t *testing.T, appAddress string, gatewayAddress string) []byte
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewAnyTimeLastNRedelegationsClient ¶
func NewAnyTimeLastNRedelegationsClient( t *testing.T, appAddress string, ) *mockclient.MockDelegationClient
NewAnyTimeLastNRedelegationsClient creates a mock DelegationClient that expects calls to the LastNRedelegations method any number of times. When the LastNRedelegations method is called, it returns a mock Redelegation with the provided appAddress.
func NewAnyTimesRedelegation ¶
func NewAnyTimesRedelegation( t *testing.T, appAddress string, gatewayAddress string, ) *mockclient.MockRedelegation
NewAnyTimesRedelegation creates a mock Redelegation that expects calls to the AppAddress method any number of times. When the method is called, it returns the provided app address.
func NewAnyTimesRedelegationsSequence ¶
func NewAnyTimesRedelegationsSequence( ctx context.Context, t *testing.T, appAddress string, redelegationObs observable.Observable[client.Redelegation], ) *mockclient.MockDelegationClient
NewAnyTimesRedelegationsSequence creates a new mock DelegationClient. This mock DelegationClient will expect any number of calls to RedelegationsSequence, and when that call is made, it returns the given EventsObservable[Redelegation].
func NewLocalnetClient ¶
NewLocalnetClient creates and returns a new DelegationClient that's configured for use with the LocalNet validator.
func NewOneTimeRedelegationsSequenceDelegationClient ¶
func NewOneTimeRedelegationsSequenceDelegationClient( ctx context.Context, t *testing.T, redelegationPublishCh chan client.Redelegation, ) *mockclient.MockDelegationClient
NewOneTimeRedelegationsSequenceDelegationClient creates a new mock DelegationClient. This mock DelegationClient will expect a call to RedelegationsSequence, and when that call is made, it returns a new RedelegationReplayObservable that publishes Redelegation events sent on the given redelegationPublishCh. redelegationPublishCh is the channel the caller can use to publish Redelegation events to the observable.
Types ¶
This section is empty.