Add function with tests to remove game

Signed-off-by: Sebastian Crane <seabass-labrax@gmx.com>
This commit is contained in:
Sebastian Crane 2022-01-01 18:29:19 +00:00
parent a1e7af5a26
commit f85458340c
2 changed files with 8 additions and 0 deletions

View File

@ -11,3 +11,6 @@
(defn remove-player-of-game [state game player]
(update-in state [:games game] #(disj % player)))
(defn remove-game [state game]
(update-in state [:games] dissoc game))

View File

@ -23,3 +23,8 @@
(is (=
'#{"player-one" "player-three"}
(get-in (remove-player-of-game test-state :imaginary-rpg "player-four") [:games :imaginary-rpg]))))
(deftest remove-game-test
(is (=
'#{:hypothetical-shooter :imaginary-rpg}
(set (keys (:games (remove-game test-state :quasi-rts)))))))