// test "create_action/1 kind: resign" { // user_1 = insert(:user) // user_2 = insert(:user) // user = insert(:user) // user_4 = insert(:user) // commander = insert(:commander) // user_data_one = build(:user_data, %{ // turn: false, position: 0, commander_id: commander.id, user_id: user_1.id // }) // user_data_two = build(:user_data, %{ // turn: false, position: 1, commander_id: commander.id, user_id: user_2.id // }) // user_data_three = build(:user_data, %{ // turn: true, // user_id: user.id, // commander_id: commander.id, // position: 2 // }) // user_data_four = build(:user_data, %{ // turn: false, position: 3, active: false, commander_id: commander.id, user_id: user_4.id // }) // game = insert(:game, %{ // user_data: [ // user_data_one, // user_data_two, // user_data_three, // user_data_four // ] // }) // insert(:game_user, %{game: game, faction: 1}) // insert(:game_user, %{game: game, faction: 2}) // action = build(:action, %{ // kind: "resign", // game_id: game.id, // user_id: user.id // }) // |> Map.from_struct() // assert {:ok, Action { // game: Game { // user_data: [ // UserData {turn: false, position: 2, active: false, state: "resign"}, // UserData {turn: false, position: 3, active: false}, // UserData {turn: true, position: 0, active: true}, // UserData {turn: false, position: 1, active: true} // ] // } // }} = Engine.create_action(action) // }