【发布时间】:2020-12-15 16:04:38
【问题描述】:
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"}
测试代码:
new_player = World.player_state(socket.id)
assert_push "initialize",
%{new_player: ^new_player, ref: nil, topic: "game:subtopic"},
100
我不确定为什么测试失败。我试着不固定新玩家。我看到的唯一区别是 join_ref 不是我的测试中返回的结构的一部分。
我不明白!
【问题讨论】:
-
哦,可能是我在测试中使用了结构体!哎呀。