Skip to content

Conversation

@Vui-Chee
Copy link
Owner

@Vui-Chee Vui-Chee commented Jun 16, 2021

Summary

  • Set up Jest for testing
  • write test cases for these actions (NEW_PIECE, ROTATE, JUST_MOVE, INSTANT_LAND, CLEAR_ROWS)

Directory structure (tentative)

The tests as of now is currently divided according to situations.

__tests__
  blocksReducer
    createPiece.js
    utils.js (functions created to assist testing)
    testUtils.js (tests for external functions)
    rotation.js
    movement
      singleDirection.js
      twoDirections.js
      noMoveIntoWalls.js
      combine.js
    instantMove
        combineWithFloor.js
        combineWithLandedBlocks.js
    clearRows.js

Vui-Chee added 30 commits June 14, 2021 19:12
Test create new valid piece.
* use toBe (no need for deep comparison)
* one more case testing if stick piece is just far
  enough from wall to rotate
Otherwise, there could unusual state overwrites interfering with
later tests.
In upside down position.

+ minor updates.
So previous orientation test after each rotation is removed.
@Vui-Chee Vui-Chee changed the title Blocks reducer tests Set up testing and write tests for blocks reducer Jun 20, 2021
Vui-Chee added 6 commits June 20, 2021 11:52
So should extract every key value from initial state and overwrite
desired fields.
function should only be focused on testing movement action.
Use to generate test extravagant cases.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants