Documentation ¶
Index ¶
- type APIMock
- func (mock *APIMock) GetOwnedGames(ctx context.Context, id string) ([]*steam.Game, error)
- func (mock *APIMock) GetOwnedGamesCalls() []struct{ ... }
- func (mock *APIMock) GetPlayerSummary(ctx context.Context, id string) (*steam.Summary, error)
- func (mock *APIMock) GetPlayerSummaryCalls() []struct{ ... }
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIMock ¶
type APIMock struct { // GetOwnedGamesFunc mocks the GetOwnedGames method. GetOwnedGamesFunc func(ctx context.Context, id string) ([]*steam.Game, error) // GetPlayerSummaryFunc mocks the GetPlayerSummary method. GetPlayerSummaryFunc func(ctx context.Context, id string) (*steam.Summary, error) // contains filtered or unexported fields }
APIMock is a mock implementation of steam.API.
func TestSomethingThatUsesAPI(t *testing.T) { // make and configure a mocked steam.API mockedAPI := &APIMock{ GetOwnedGamesFunc: func(ctx context.Context, id string) ([]*steam.Game, error) { panic("mock out the GetOwnedGames method") }, GetPlayerSummaryFunc: func(ctx context.Context, id string) (*steam.Summary, error) { panic("mock out the GetPlayerSummary method") }, } // use mockedAPI in code that requires steam.API // and then make assertions. }
func (*APIMock) GetOwnedGames ¶
GetOwnedGames calls GetOwnedGamesFunc.
func (*APIMock) GetOwnedGamesCalls ¶
GetOwnedGamesCalls gets all the calls that were made to GetOwnedGames. Check the length with:
len(mockedAPI.GetOwnedGamesCalls())
func (*APIMock) GetPlayerSummary ¶
GetPlayerSummary calls GetPlayerSummaryFunc.
Click to show internal directories.
Click to hide internal directories.