mock

package
v0.0.0-...-3cf9108 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 4, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockClientMock

type BlockClientMock struct {
	// LatestSyncInfoFunc mocks the LatestSyncInfo method.
	LatestSyncInfoFunc func(ctx context.Context) (*coretypes.SyncInfo, error)

	// SubscribeFunc mocks the Subscribe method.
	SubscribeFunc func(ctx context.Context, subscriber string, query string, outCapacity ...int) (<-chan coretypes.ResultEvent, error)

	// UnsubscribeFunc mocks the Unsubscribe method.
	UnsubscribeFunc func(ctx context.Context, subscriber string, query string) error
	// contains filtered or unexported fields
}

BlockClientMock is a mock implementation of events.BlockClient.

func TestSomethingThatUsesBlockClient(t *testing.T) {

	// make and configure a mocked events.BlockClient
	mockedBlockClient := &BlockClientMock{
		LatestSyncInfoFunc: func(ctx context.Context) (*coretypes.SyncInfo, error) {
			panic("mock out the LatestSyncInfo method")
		},
		SubscribeFunc: func(ctx context.Context, subscriber string, query string, outCapacity ...int) (<-chan coretypes.ResultEvent, error) {
			panic("mock out the Subscribe method")
		},
		UnsubscribeFunc: func(ctx context.Context, subscriber string, query string) error {
			panic("mock out the Unsubscribe method")
		},
	}

	// use mockedBlockClient in code that requires events.BlockClient
	// and then make assertions.

}

func (*BlockClientMock) LatestSyncInfo

func (mock *BlockClientMock) LatestSyncInfo(ctx context.Context) (*coretypes.SyncInfo, error)

LatestSyncInfo calls LatestSyncInfoFunc.

func (*BlockClientMock) LatestSyncInfoCalls

func (mock *BlockClientMock) LatestSyncInfoCalls() []struct {
	Ctx context.Context
}

LatestSyncInfoCalls gets all the calls that were made to LatestSyncInfo. Check the length with:

len(mockedBlockClient.LatestSyncInfoCalls())

func (*BlockClientMock) Subscribe

func (mock *BlockClientMock) Subscribe(ctx context.Context, subscriber string, query string, outCapacity ...int) (<-chan coretypes.ResultEvent, error)

Subscribe calls SubscribeFunc.

func (*BlockClientMock) SubscribeCalls

func (mock *BlockClientMock) SubscribeCalls() []struct {
	Ctx         context.Context
	Subscriber  string
	Query       string
	OutCapacity []int
}

SubscribeCalls gets all the calls that were made to Subscribe. Check the length with:

len(mockedBlockClient.SubscribeCalls())

func (*BlockClientMock) Unsubscribe

func (mock *BlockClientMock) Unsubscribe(ctx context.Context, subscriber string, query string) error

Unsubscribe calls UnsubscribeFunc.

func (*BlockClientMock) UnsubscribeCalls

func (mock *BlockClientMock) UnsubscribeCalls() []struct {
	Ctx        context.Context
	Subscriber string
	Query      string
}

UnsubscribeCalls gets all the calls that were made to Unsubscribe. Check the length with:

len(mockedBlockClient.UnsubscribeCalls())

type BlockNotifierMock

type BlockNotifierMock struct {
	// BlockHeightsFunc mocks the BlockHeights method.
	BlockHeightsFunc func(ctx context.Context) (<-chan int64, <-chan error)

	// DoneFunc mocks the Done method.
	DoneFunc func() <-chan struct{}
	// contains filtered or unexported fields
}

BlockNotifierMock is a mock implementation of events.BlockNotifier.

func TestSomethingThatUsesBlockNotifier(t *testing.T) {

	// make and configure a mocked events.BlockNotifier
	mockedBlockNotifier := &BlockNotifierMock{
		BlockHeightsFunc: func(ctx context.Context) (<-chan int64, <-chan error) {
			panic("mock out the BlockHeights method")
		},
		DoneFunc: func() <-chan struct{} {
			panic("mock out the Done method")
		},
	}

	// use mockedBlockNotifier in code that requires events.BlockNotifier
	// and then make assertions.

}

func (*BlockNotifierMock) BlockHeights

func (mock *BlockNotifierMock) BlockHeights(ctx context.Context) (<-chan int64, <-chan error)

BlockHeights calls BlockHeightsFunc.

func (*BlockNotifierMock) BlockHeightsCalls

func (mock *BlockNotifierMock) BlockHeightsCalls() []struct {
	Ctx context.Context
}

BlockHeightsCalls gets all the calls that were made to BlockHeights. Check the length with:

len(mockedBlockNotifier.BlockHeightsCalls())

func (*BlockNotifierMock) Done

func (mock *BlockNotifierMock) Done() <-chan struct{}

Done calls DoneFunc.

func (*BlockNotifierMock) DoneCalls

func (mock *BlockNotifierMock) DoneCalls() []struct {
}

DoneCalls gets all the calls that were made to Done. Check the length with:

len(mockedBlockNotifier.DoneCalls())

type BlockResultClientMock

type BlockResultClientMock struct {
	// BlockResultsFunc mocks the BlockResults method.
	BlockResultsFunc func(ctx context.Context, height *int64) (*coretypes.ResultBlockResults, error)
	// contains filtered or unexported fields
}

BlockResultClientMock is a mock implementation of events.BlockResultClient.

func TestSomethingThatUsesBlockResultClient(t *testing.T) {

	// make and configure a mocked events.BlockResultClient
	mockedBlockResultClient := &BlockResultClientMock{
		BlockResultsFunc: func(ctx context.Context, height *int64) (*coretypes.ResultBlockResults, error) {
			panic("mock out the BlockResults method")
		},
	}

	// use mockedBlockResultClient in code that requires events.BlockResultClient
	// and then make assertions.

}

func (*BlockResultClientMock) BlockResults

func (mock *BlockResultClientMock) BlockResults(ctx context.Context, height *int64) (*coretypes.ResultBlockResults, error)

BlockResults calls BlockResultsFunc.

func (*BlockResultClientMock) BlockResultsCalls

func (mock *BlockResultClientMock) BlockResultsCalls() []struct {
	Ctx    context.Context
	Height *int64
}

BlockResultsCalls gets all the calls that were made to BlockResults. Check the length with:

len(mockedBlockResultClient.BlockResultsCalls())

type BlockSourceMock

type BlockSourceMock struct {
	// BlockResultsFunc mocks the BlockResults method.
	BlockResultsFunc func(ctx context.Context) (<-chan *coretypes.ResultBlockResults, <-chan error)

	// DoneFunc mocks the Done method.
	DoneFunc func() <-chan struct{}
	// contains filtered or unexported fields
}

BlockSourceMock is a mock implementation of events.BlockSource.

func TestSomethingThatUsesBlockSource(t *testing.T) {

	// make and configure a mocked events.BlockSource
	mockedBlockSource := &BlockSourceMock{
		BlockResultsFunc: func(ctx context.Context) (<-chan *coretypes.ResultBlockResults, <-chan error) {
			panic("mock out the BlockResults method")
		},
		DoneFunc: func() <-chan struct{} {
			panic("mock out the Done method")
		},
	}

	// use mockedBlockSource in code that requires events.BlockSource
	// and then make assertions.

}

func (*BlockSourceMock) BlockResults

func (mock *BlockSourceMock) BlockResults(ctx context.Context) (<-chan *coretypes.ResultBlockResults, <-chan error)

BlockResults calls BlockResultsFunc.

func (*BlockSourceMock) BlockResultsCalls

func (mock *BlockSourceMock) BlockResultsCalls() []struct {
	Ctx context.Context
}

BlockResultsCalls gets all the calls that were made to BlockResults. Check the length with:

len(mockedBlockSource.BlockResultsCalls())

func (*BlockSourceMock) Done

func (mock *BlockSourceMock) Done() <-chan struct{}

Done calls DoneFunc.

func (*BlockSourceMock) DoneCalls

func (mock *BlockSourceMock) DoneCalls() []struct {
}

DoneCalls gets all the calls that were made to Done. Check the length with:

len(mockedBlockSource.DoneCalls())

type Query

type Query tmpubsub.Query

Query interface alias for mocking

type QueryMock

type QueryMock struct {
	// MatchesFunc mocks the Matches method.
	MatchesFunc func(events map[string][]string) (bool, error)

	// StringFunc mocks the String method.
	StringFunc func() string
	// contains filtered or unexported fields
}

QueryMock is a mock implementation of Query.

func TestSomethingThatUsesQuery(t *testing.T) {

	// make and configure a mocked Query
	mockedQuery := &QueryMock{
		MatchesFunc: func(events map[string][]string) (bool, error) {
			panic("mock out the Matches method")
		},
		StringFunc: func() string {
			panic("mock out the String method")
		},
	}

	// use mockedQuery in code that requires Query
	// and then make assertions.

}

func (*QueryMock) Matches

func (mock *QueryMock) Matches(events map[string][]string) (bool, error)

Matches calls MatchesFunc.

func (*QueryMock) MatchesCalls

func (mock *QueryMock) MatchesCalls() []struct {
	Events map[string][]string
}

MatchesCalls gets all the calls that were made to Matches. Check the length with:

len(mockedQuery.MatchesCalls())

func (*QueryMock) String

func (mock *QueryMock) String() string

String calls StringFunc.

func (*QueryMock) StringCalls

func (mock *QueryMock) StringCalls() []struct {
}

StringCalls gets all the calls that were made to String. Check the length with:

len(mockedQuery.StringCalls())

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL