diff --git a/test/test_game.py b/test/test_game.py index e69de29..dd25a2d 100644 --- a/test/test_game.py +++ b/test/test_game.py @@ -0,0 +1,30 @@ +from unittest import TestCase + +from model.data import Game, Player + + +class TestGame(TestCase): + def setUp(self) -> None: + super().setUp() + self.player1 = Player(name="") + self.player2 = Player() + self.game = Game([self.player1, self.player2]) + + def test_global_hand(self) -> None: + card1 = self.game.deck.random_card() + self.player1.give(card1) + + card2 = self.game.deck.random_card() + card3 = self.game.deck.random_card() + self.player2.give(card2) + self.player2.give(card3) + + self.assertTrue(card1 in self.game.global_hand, "Global hand should contain player1's card") + self.assertTrue(card2 in self.game.global_hand, "Global hand should contain player2's first card") + self.assertTrue(card3 in self.game.global_hand, "Global hand should contain player2's second card") + + def test_turn(self): + self.game.new_turn() + + self.assertEqual(1, len(self.game.defeats.values()), "There should have been one defeat.") + self.assertTrue(1 in self.game.defeats.values(), "A player should have one defeat.")