Add function with tests to get list of games

Signed-off-by: Sebastian Crane <seabass-labrax@gmx.com>
This commit is contained in:
Sebastian Crane 2022-01-03 14:27:19 +00:00
parent 242873a713
commit 905c6ada4c
2 changed files with 8 additions and 0 deletions

View File

@ -12,5 +12,8 @@
(defn remove-player-of-game [state game player]
(update-in state [:games game] #(disj % player)))
(defn get-games [state]
(keys (:games state)))
(defn remove-game [state game]
(update-in state [:games] dissoc game))

View File

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