il y a t-il une erreur de logique ? "    describe("vérifie le comportement de la fonction joinGame dans le contrat PlayerManagement", () => {

      it("should allow a player to join a game", async () => {
        const gameId = 1;
        const initialPlayerCount = await playerManagementInstance.getPlayerCount();
        
        // Call the joinGame function
        await playerManagementInstance.joinGame(gameId, { from: player1, value: Web3.utils.toWei("1", "ether") });
        
        // Validate the player count has increased by 1
        const newPlayerCount = await playerManagementInstance.getPlayerCount();
        expect(newPlayerCount).to.be.bignumber.equal(initialPlayerCount.add(new BN(1)));
        
        // Validate the player1 address is added to the game
        const players = await playerManagementInstance.getGamePlayers(gameId);
        expect(players[0]).to.equal(player1);
      });
    
      it("should perform validation checks, handle refund, update player2, switch players, and emit events when joining a game", async () => {
        const gameId = 1;
        const player1 = accounts[0];
        const player2 = accounts[1];
      
        // Join game as player1
        const joinGameResult = await playerManagementInstance.joinGame(gameId, { from: player2, value: Web3.utils.toWei("1", "ether") });
        expect(joinGameResult).to.equal(true);
      
        // Check validJoin
        const validJoinResult = await playerManagementInstance.validJoin(gameId);
        expect(validJoinResult).to.equal(true);
      
        // Check handleRefund
        const handleRefundResult = await playerManagementInstance.handleRefund(gameId);
        expect(handleRefundResult).to.equal(true);
      
        // Check refund exception
        await expectRevert(playerManagementInstance.handleRefund(gameId, { from: player2 }), "Refund not applicable");
        
        // Check updatePlayer2
        const updatePlayer2Result = await playerManagementInstance.updatePlayer2(gameId);
        expect(updatePlayer2Result).to.equal(true);
      
        // Check playersSwitched
        const playersSwitchedResult = await playerManagementInstance.playersSwitched(gameId);
        expect(playersSwitchedResult).to.equal(true);

        // Update player2
        await playerManagementInstance.updatePlayer2(gameId, { from: player2 });
        const player2Address = await playerManagementInstance.player2(gameId);
        expect(player2Address).to.equal(player2);
      
        // Switch players
        await playerManagementInstance.playersSwitched(gameId, { from: player2 });
        const switchedPlayer1 = await playerManagementInstance.player1(gameId);
        const switchedPlayer2 = await playerManagementInstance.player2(gameId);
        expect(switchedPlayer1).to.equal(player2);
        expect(switchedPlayer2).to.equal(player1);

         // Emit PlayerSwitched event
         expectEvent(result, "PlayerSwitched", {
          gameId: new BN(gameId),
          player1: player2,
          player2: player1,
        });

        // Emit GameJoined event
        expectEvent(result, "GameJoined", {
          gameId: new BN(gameId),
          player1: player2,
          player2: player1,
        });
      });
    });"