Add function with tests to remove player from game

Signed-off-by: Sebastian Crane <seabass-labrax@gmx.com>
This commit is contained in:
Sebastian Crane 2022-01-01 17:57:47 +00:00
parent f15c08e2cd
commit e224e02e86
2 changed files with 8 additions and 0 deletions

View File

@ -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)))

View File

@ -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]))))