test

package
v0.0.0-...-12329ce Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2020 License: GPL-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 Mock

type Mock interface {

	// ** Game
	HandleAmongUsEvent(interface{}, mybot.AuEventType)
	HandleLobbyEvent(string)
	HandlePlayerEvent(*mybot.AmongUsPlayerEvent)
	HandleStateEvent(mybot.AuEventState)
	ResetGameState()
	BeginRound()
	BeginChattingState()
	GetGameFromCode(string) *mybot.Game

	SocketEvLobby(s socketio.Conn, msg string)

	IsAlive()
	SetIsAlive(isAlive bool)
	UnMute()

	// ** Mute exist for entities and for AuPlayer
	Mute(bool)

	GetEntityId(string) string
	GetEntity(entityId string) interface{}
	AddEntity(entity interface{})
	RemoveEntity(entity string)

	// ** mock reel code logic
	VerifyFuncCall() error
	AssertFuncCalledWith(funcName string, args ...interface{})
}

Test to implement this kind of mock :

https://dev.to/jonfriesen/mocking-dependencies-in-go-1h4d

func NewMockObj

func NewMockObj(functions map[string]func(...interface{}) interface{}) Mock

type MockObj

type MockObj struct {
	HandleAmongUsEventFunc func(...interface{}) interface{}
	HandleLobbyEventFunc   func(...interface{}) interface{}
	HandlePlayerEventFunc  func(...interface{}) interface{}
	SocketEvLobbyFunc      func(...interface{}) interface{}
	GetEntityIdFunc        func(...interface{}) interface{}
	MuteFunc               func(...interface{}) interface{}
	GetEntityFunc          func(...interface{}) interface{}
	AddEntityFunc          func(...interface{}) interface{}
	RemoveEntityFunc       func(...interface{}) interface{}
	ResetGameStateFunc     func(...interface{}) interface{}
	BeginRoundFunc         func(...interface{}) interface{}
	BeginChattingStateFunc func(...interface{}) interface{}
	IsAliveFunc            func(...interface{}) interface{}
	SetIsAliveFunc         func(...interface{}) interface{}
	UnMuteFunc             func(...interface{}) interface{}
	GetGameFromCodeFunc    func(...interface{}) interface{}
	HandleStateEventFunc   func(...interface{}) interface{}
	// contains filtered or unexported fields
}

func (*MockObj) AddEntity

func (mockobj *MockObj) AddEntity(msg interface{})

func (*MockObj) AssertFuncCalledWith

func (mockObj *MockObj) AssertFuncCalledWith(funcName string, args ...interface{})

func (*MockObj) BeginChattingState

func (mockobj *MockObj) BeginChattingState()

func (*MockObj) BeginRound

func (mockobj *MockObj) BeginRound()

func (*MockObj) GetEntity

func (mockobj *MockObj) GetEntity(msg string) interface{}

func (*MockObj) GetEntityId

func (mockobj *MockObj) GetEntityId(name string) string

func (*MockObj) GetGameFromCode

func (mockobj *MockObj) GetGameFromCode(code string) *mybot.Game

func (*MockObj) HandleAmongUsEvent

func (mockobj *MockObj) HandleAmongUsEvent(arg1 interface{}, arg2 mybot.AuEventType)

func (*MockObj) HandleLobbyEvent

func (mockobj *MockObj) HandleLobbyEvent(msg string)

func (*MockObj) HandlePlayerEvent

func (mockobj *MockObj) HandlePlayerEvent(arg *mybot.AmongUsPlayerEvent)

func (*MockObj) HandleStateEvent

func (mockobj *MockObj) HandleStateEvent(event mybot.AuEventState)

func (*MockObj) IsAlive

func (mockobj *MockObj) IsAlive()

func (*MockObj) Mute

func (mockobj *MockObj) Mute(arg bool)

func (*MockObj) RemoveEntity

func (mockobj *MockObj) RemoveEntity(msg string)

func (*MockObj) ResetGameState

func (mockobj *MockObj) ResetGameState()

func (*MockObj) SetIsAlive

func (mockobj *MockObj) SetIsAlive(arg bool)

func (*MockObj) SocketEvLobby

func (mockobj *MockObj) SocketEvLobby(sess socketio.Conn, msg string)

func (*MockObj) UnMute

func (mockobj *MockObj) UnMute()

func (*MockObj) VerifyFuncCall

func (mockObj *MockObj) VerifyFuncCall() error

All the complex reflect logic should appen there not in the two previous func (assertCalledWith and recordFuncCall)

Jump to

Keyboard shortcuts

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