diff --git a/src/game.clj b/src/game.clj index 52e0b1c..5d21e82 100644 --- a/src/game.clj +++ b/src/game.clj @@ -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)) diff --git a/test/game_test.clj b/test/game_test.clj index eda30f5..7edb743 100644 --- a/test/game_test.clj +++ b/test/game_test.clj @@ -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}