Documentation ¶
Index ¶
- type Mock
- type MockObj
- func (mockobj *MockObj) AddEntity(msg interface{})
- func (mockObj *MockObj) AssertFuncCalledWith(funcName string, args ...interface{})
- func (mockobj *MockObj) BeginChattingState()
- func (mockobj *MockObj) BeginRound()
- func (mockobj *MockObj) GetEntity(msg string) interface{}
- func (mockobj *MockObj) GetEntityId(name string) string
- func (mockobj *MockObj) GetGameFromCode(code string) *mybot.Game
- func (mockobj *MockObj) HandleAmongUsEvent(arg1 interface{}, arg2 mybot.AuEventType)
- func (mockobj *MockObj) HandleLobbyEvent(msg string)
- func (mockobj *MockObj) HandlePlayerEvent(arg *mybot.AmongUsPlayerEvent)
- func (mockobj *MockObj) HandleStateEvent(event mybot.AuEventState)
- func (mockobj *MockObj) IsAlive()
- func (mockobj *MockObj) Mute(arg bool)
- func (mockobj *MockObj) RemoveEntity(msg string)
- func (mockobj *MockObj) ResetGameState()
- func (mockobj *MockObj) SetIsAlive(arg bool)
- func (mockobj *MockObj) SocketEvLobby(sess socketio.Conn, msg string)
- func (mockobj *MockObj) UnMute()
- func (mockObj *MockObj) VerifyFuncCall() error
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 ¶
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) AssertFuncCalledWith ¶
func (*MockObj) BeginChattingState ¶
func (mockobj *MockObj) BeginChattingState()
func (*MockObj) BeginRound ¶
func (mockobj *MockObj) BeginRound()
func (*MockObj) GetEntityId ¶
func (*MockObj) HandleAmongUsEvent ¶
func (mockobj *MockObj) HandleAmongUsEvent(arg1 interface{}, arg2 mybot.AuEventType)
func (*MockObj) HandleLobbyEvent ¶
func (*MockObj) HandlePlayerEvent ¶
func (mockobj *MockObj) HandlePlayerEvent(arg *mybot.AmongUsPlayerEvent)
func (*MockObj) HandleStateEvent ¶
func (mockobj *MockObj) HandleStateEvent(event mybot.AuEventState)
func (*MockObj) RemoveEntity ¶
func (*MockObj) ResetGameState ¶
func (mockobj *MockObj) ResetGameState()
func (*MockObj) SetIsAlive ¶
func (*MockObj) SocketEvLobby ¶
func (*MockObj) VerifyFuncCall ¶
All the complex reflect logic should appen there not in the two previous func (assertCalledWith and recordFuncCall)
Click to show internal directories.
Click to hide internal directories.