You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In a test, if I call server.emit('an-event', {foo: 'bar'}), the socket in my test will receive [Object object] as the payload. The exact code is below.
I am using the Socket.IO implementation and it allows objects to be given as arguments to emit()as can be seen here. I would assume this library should also respect that.
it(`dispatches setCurrentPlayer() when Events.ChangeCurrentPlayer event is received`,()=>{constcurrentPlayer: Player={id: '1',color: 'red'}constplayerList: Player[]=[currentPlayer,{id: '2',color: 'blue'}]constserver=newServer(configuration.server.uri)conststore=createMockedStore({},SocketIO)store.dispatch(joinAction)constaction=switchCurrentPlayer(currentPlayer,playerList)server.emit(Events.ChangeCurrentPlayer,action.payload)// This is the relevant bit// Next line will fail, error after this. expect(store.getActions()).toContainObject(setCurrentPlayer(action.payload))})
Notice the object with type: setCurrentPlayer in the expected and received.
In a test, if I call
server.emit('an-event', {foo: 'bar'})
, the socket in my test will receive[Object object]
as the payload. The exact code is below.I am using the Socket.IO implementation and it allows objects to be given as arguments to
emit()
as can be seen here. I would assume this library should also respect that.Notice the object with
type: setCurrentPlayer
in the expected and received.The text was updated successfully, but these errors were encountered: