Reputation: 2019
No message matching %Phoenix.Socket.Message{event: "initialize", payload: %{new_player: ^new_player, ref: nil, topic: "game:subtopic"}} after 100ms.
The following variables were pinned:
new_player = %Player.State{hp: %{current: 10, max: 10}, position: %{target_x: 0, target_z: 0, x: 0, z: 0}, socket_id: "user_id", username: nil}
Process mailbox:
%Phoenix.Socket.Message{event: "initialize", join_ref: 714, payload: %{new_player: %Player.State{hp: %{current: 10, max: 10}, position: %{target_x: 0, target_z: 0, x: 0, z: 0}, socket_id: "user_id", username: nil}}, ref: nil, topic: "game:subtopic"}
The code from the test:
new_player = World.player_state(socket.id)
assert_push "initialize",
%{new_player: ^new_player, ref: nil, topic: "game:subtopic"},
100
I'm not sure why the test if failing. I tried not pinning the new player. The only difference I see is join_ref
isn't a part of the struct returned in my test.
I don't understand!
Upvotes: 0
Views: 130
Reputation: 3159
The two following fields are actually not part of the payload
but of the Phoenix.Socket.Message
, which is why it is not matching I believe: ref: nil, topic: "game:subtopic"
.
If you remove those two it should match.
Upvotes: 0