import { playerMoveAction, PLAYER_MOVE } from "src/actions/GameActions.js";
import { computerMoveAction, COMPUTER_MOVE } from "src/actions/GameActions.js";
import { resetGameAction, RESET_GAME } from "src/actions/GameActions.js";
import { setGameModeAction, SET_GAME_MODE } from "src/actions/GameActions.js";

describe("Game Actions", () => {

  it("should exist", () => {
    playerMoveAction.should.exist;
    computerMoveAction.should.exist;
    resetGameAction.should.exist;
    setGameModeAction.should.exist;
  });

  it("should be a function", () => {
    playerMoveAction.should.be.function;
    computerMoveAction.should.be.function;
    resetGameAction.should.be.function;
    setGameModeAction.should.be.function;
  });

  describe("playerMoveAction", () => {

    it("should create action of type PLAYER_MOVE", () => {
      const action = playerMoveAction(0,0);
      action.type.should.be.equal(PLAYER_MOVE);
    });

    it("should have props x, y equal to function arguments", () => {
      var action = playerMoveAction(0,0);

      const playerMoveAt00 = {
        x: 0,
        y: 0,
        type: PLAYER_MOVE
      };

      action.should.be.eql(playerMoveAt00);
    });

    it("should have props x, y equal to function arguments", () => {
      var action = playerMoveAction(2,1);

      const playerMoveAt21 = {
        x: 2,
        y: 1,
        type: PLAYER_MOVE
      };

      action.should.be.eql(playerMoveAt21);
    });

  });

  describe("computerMoveAction", () => {

    it("should create action of type COMPUTER_MOVE", () => {
      const action = computerMoveAction();
      action.type.should.be.equal(COMPUTER_MOVE);
    });

    it("should have nothing else but action type", () => {
      var action = computerMoveAction( );

      const computerMove = {
        type: COMPUTER_MOVE
      };

      action.should.be.eql(computerMove);
    });

  });

  describe("resetGameAction", () => {

    it("should create action of type RESET_GAME", () => {
      const action = resetGameAction();
      action.type.should.be.equal(RESET_GAME);
    });

    it("should have nothing else but action type", () => {
      var action = resetGameAction();

      const computerMove = {
        type: RESET_GAME
      };

      action.should.be.eql(computerMove);
    });

  });

  describe("setGameModeAction", () => {

    it("should create action of type SET_GAME_MODE", () => {
      const action = setGameModeAction("TEST");
      action.type.should.be.equal(SET_GAME_MODE);
    });

    it("should use first argument as game mode", () => {
      const action = setGameModeAction("TEST");

      const testAction = {
        mode: "TEST",
        type: SET_GAME_MODE
      };

      action.should.be.eql(testAction);
    });

    it("should use first argument as game mode", () => {
      const action = setGameModeAction("TEST_NUMBER_TWO");

      const testAction = {
        mode: "TEST_NUMBER_TWO",
        type: SET_GAME_MODE
      };

      action.should.be.eql(testAction);
    });

  });

});

@@ -2,22 +2,21 @@
 mport %7B 
-player
+apply
 MoveActi
@@ -19,22 +19,21 @@
 Action, 
-PLAYER
+APPLY
 _MOVE %7D 
@@ -80,41 +80,55 @@
 t %7B 
-computerMoveAction, COMPUTER_MOVE
+startNextMacthAction,%0A         START_NEXT_MATCH
  %7D f
@@ -374,38 +374,37 @@
 t%22, () =%3E %7B%0A    
-player
+apply
 MoveAction.shoul
@@ -412,36 +412,38 @@
 .exist;%0A    
-computerMove
+startNextMacth
 Action.shoul
@@ -569,22 +569,21 @@
 %3E %7B%0A    
-player
+apply
 MoveActi
@@ -609,28 +609,30 @@
 on;%0A    
-computerMove
+startNextMacth
 Action.s
@@ -751,22 +751,21 @@
 scribe(%22
-player
+apply
 MoveActi
@@ -815,22 +815,21 @@
 of type 
-PLAYER
+APPLY
 _MOVE%22, 
@@ -849,38 +849,37 @@
  const action = 
-player
+apply
 MoveAction(0,0);
@@ -913,22 +913,21 @@
 e.equal(
-PLAYER
+APPLY
 _MOVE);%0A
@@ -1015,38 +1015,37 @@
    var action = 
-player
+apply
 MoveAction(0,0);
@@ -1111,38 +1111,37 @@
 ,%0A        type: 
-PLAYER
+APPLY
 _MOVE%0A      %7D;%0A%0A
@@ -1281,22 +1281,21 @@
 ction = 
-player
+apply
 MoveActi
@@ -1381,14 +1381,13 @@
 pe: 
-PLAYER
+APPLY
 _MOV
@@ -1470,28 +1470,30 @@
 scribe(%22
-computerMove
+startNextMacth
 Action%22,
@@ -1539,29 +1539,32 @@
 of type 
-COMPUTER_MOVE
+START_NEXT_MATCH
 %22, () =%3E
@@ -1583,36 +1583,38 @@
 st action = 
-computerMove
+startNextMacth
 Action();%0A  
@@ -1645,29 +1645,32 @@
 e.equal(
-COMPUTER_MOVE
+START_NEXT_MATCH
 );%0A    %7D
@@ -1755,28 +1755,29 @@
 n = 
-computerMove
+startNextMacth
 Action(
- 
 );%0A%0A
@@ -1784,36 +1784,38 @@
       const 
-computerMove
+startNextMatch
  = %7B%0A       
@@ -1825,21 +1825,24 @@
 pe: 
-COMPUTER_MOVE
+START_NEXT_MATCH
 %0A   
@@ -1871,36 +1871,38 @@
 ould.be.eql(
-computerMove
+startNextMatch
 );%0A    %7D);%0A%0A

Update tests due to action updates