From f85458340c93070bd828f8b839c55b89b6fb3c91 Mon Sep 17 00:00:00 2001 From: Sebastian Crane Date: Sat, 1 Jan 2022 18:29:19 +0000 Subject: [PATCH] Add function with tests to remove game Signed-off-by: Sebastian Crane --- src/game.clj | 3 +++ test/game_test.clj | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/src/game.clj b/src/game.clj index 29e947e..7cfc2f6 100644 --- a/src/game.clj +++ b/src/game.clj @@ -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)) diff --git a/test/game_test.clj b/test/game_test.clj index 1706c94..fc9cb4f 100644 --- a/test/game_test.clj +++ b/test/game_test.clj @@ -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)))))))