Closed HoppenR closed 4 months ago
This allows using a mock websocket to stress test the trivia bot in the future. Intended to be used like this.
mockDialer := func(ctx context.Context, url string, opts *websocket.DialOptions) (WebsocketConn, *http.Response, error) { webMocket := new(MockWebSocketConn) // Add custom logic for what to return on different calls webMocket.On("Read", mock.Anything).Return(SOME_RETURN_VAL) return webMocket, nil, nil } bot, err := New( new(zap.SugaredLogger), mockDialer, "wss://chat2.strims.gg/ws", // or whatever... "placeholderToken", true, "leaderboardPage", "leaderboardIngress", ) assert.Nil(t, err) assert.NotNil(t, bot)
Can set up different return values from Read() like this.
Read()
webMocket.On("Read", mock.Anything).Return(someRet).Once() webMocket.On("Read", mock.Anything).Return(otherRet).Once()
This allows using a mock websocket to stress test the trivia bot in the future. Intended to be used like this.