mock

package
v0.17.2 Latest Latest
Warning

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

Go to latest
Published: May 4, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RewardPoolMock

type RewardPoolMock struct {
	// AddRewardFunc mocks the AddReward method.
	AddRewardFunc func(valAddress sdk.ValAddress, coin sdk.Coin)

	// ClearRewardsFunc mocks the ClearRewards method.
	ClearRewardsFunc func(valAddress sdk.ValAddress)

	// ReleaseRewardsFunc mocks the ReleaseRewards method.
	ReleaseRewardsFunc func(valAddress sdk.ValAddress) error
	// contains filtered or unexported fields
}

RewardPoolMock is a mock implementation of exported.RewardPool.

func TestSomethingThatUsesRewardPool(t *testing.T) {

	// make and configure a mocked exported.RewardPool
	mockedRewardPool := &RewardPoolMock{
		AddRewardFunc: func(valAddress sdk.ValAddress, coin sdk.Coin)  {
			panic("mock out the AddReward method")
		},
		ClearRewardsFunc: func(valAddress sdk.ValAddress)  {
			panic("mock out the ClearRewards method")
		},
		ReleaseRewardsFunc: func(valAddress sdk.ValAddress) error {
			panic("mock out the ReleaseRewards method")
		},
	}

	// use mockedRewardPool in code that requires exported.RewardPool
	// and then make assertions.

}

func (*RewardPoolMock) AddReward

func (mock *RewardPoolMock) AddReward(valAddress sdk.ValAddress, coin sdk.Coin)

AddReward calls AddRewardFunc.

func (*RewardPoolMock) AddRewardCalls

func (mock *RewardPoolMock) AddRewardCalls() []struct {
	ValAddress sdk.ValAddress
	Coin       sdk.Coin
}

AddRewardCalls gets all the calls that were made to AddReward. Check the length with:

len(mockedRewardPool.AddRewardCalls())

func (*RewardPoolMock) ClearRewards

func (mock *RewardPoolMock) ClearRewards(valAddress sdk.ValAddress)

ClearRewards calls ClearRewardsFunc.

func (*RewardPoolMock) ClearRewardsCalls

func (mock *RewardPoolMock) ClearRewardsCalls() []struct {
	ValAddress sdk.ValAddress
}

ClearRewardsCalls gets all the calls that were made to ClearRewards. Check the length with:

len(mockedRewardPool.ClearRewardsCalls())

func (*RewardPoolMock) ReleaseRewards

func (mock *RewardPoolMock) ReleaseRewards(valAddress sdk.ValAddress) error

ReleaseRewards calls ReleaseRewardsFunc.

func (*RewardPoolMock) ReleaseRewardsCalls

func (mock *RewardPoolMock) ReleaseRewardsCalls() []struct {
	ValAddress sdk.ValAddress
}

ReleaseRewardsCalls gets all the calls that were made to ReleaseRewards. Check the length with:

len(mockedRewardPool.ReleaseRewardsCalls())

Jump to

Keyboard shortcuts

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