diff --git a/src/game.clj b/src/game.clj index cd32e03..29e947e 100644 --- a/src/game.clj +++ b/src/game.clj @@ -8,3 +8,6 @@ (defn add-player-of-game [state game player] (update-in state [:games game] #(conj % player))) + +(defn remove-player-of-game [state game player] + (update-in state [:games game] #(disj % player))) diff --git a/test/game_test.clj b/test/game_test.clj index 39b6c55..1706c94 100644 --- a/test/game_test.clj +++ b/test/game_test.clj @@ -18,3 +18,8 @@ (is (= '#{"player-one" "player-two" "player-four"} (get-in (add-player-of-game test-state :quasi-rts "player-one") [:games :quasi-rts])))) + +(deftest remove-player-of-game-test + (is (= + '#{"player-one" "player-three"} + (get-in (remove-player-of-game test-state :imaginary-rpg "player-four") [:games :imaginary-rpg]))))