forked from LibreGaming/matchbot
Add function with tests to remove player from game
Signed-off-by: Sebastian Crane <seabass-labrax@gmx.com>
This commit is contained in:
parent
f15c08e2cd
commit
e224e02e86
|
@ -8,3 +8,6 @@
|
||||||
|
|
||||||
(defn add-player-of-game [state game player]
|
(defn add-player-of-game [state game player]
|
||||||
(update-in state [:games game] #(conj % player)))
|
(update-in state [:games game] #(conj % player)))
|
||||||
|
|
||||||
|
(defn remove-player-of-game [state game player]
|
||||||
|
(update-in state [:games game] #(disj % player)))
|
||||||
|
|
|
@ -18,3 +18,8 @@
|
||||||
(is (=
|
(is (=
|
||||||
'#{"player-one" "player-two" "player-four"}
|
'#{"player-one" "player-two" "player-four"}
|
||||||
(get-in (add-player-of-game test-state :quasi-rts "player-one") [:games :quasi-rts]))))
|
(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]))))
|
||||||
|
|
Loading…
Reference in New Issue