Skip to content

Commit 74617d5

Browse files
committed
game tests: fix shooting tests
1 parent 3f4e758 commit 74617d5

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

test/hyperspace/test/server/game.clj

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,15 @@
6363
(is (= (:players world1) [player1
6464
(assoc player2
6565
:status :dead)]) "player 2 should be dead")
66-
(is (= targets [nil player2]))))))
66+
(is (= targets [player2 nil]))))))
6767

6868
(deftest planet-shot-test
6969
(let [game (game/create 800 600)
7070
world (:world @game)
7171
player1id "player1"
7272
player2id "player2"
7373
planet (first (:planets world))
74+
single-planet-world (assoc world :planets [planet])
7475
players (:players world)
7576
player1 (first players)
7677
player2 (second players)
@@ -79,13 +80,14 @@
7980
(game/add-player game player1id)
8081
(game/add-player game player2id)
8182
(await game)
82-
(let [[world1 targets] (game/process-turn @game [world []] [player1id turn1])]
83-
(is (= world1 world) "world should not change")
83+
(let [[world1 targets] (game/process-turn @game [single-planet-world []] [player1id turn1])]
84+
(is (= world1 single-planet-world) "world should not change")
8485
(is (= targets [planet])))))
8586

8687
(deftest player-shot-test
8788
(let [game (game/create 800 600)
88-
world (:world @game)
89+
world (-> (:world @game)
90+
(assoc :planets []))
8991
player1id "player1"
9092
player2id "player2"
9193
planet (first (:planets world))

0 commit comments

Comments
 (0)