Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor test suite #52

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Refactor test suite #52

wants to merge 1 commit into from

Conversation

greena13
Copy link

This pull request improves the test suite's structure, readability and coverage.

Changes

Testing dependencies

  • Upgrade test dependencies to the latest versions to take advantage of the latest syntax and performance
  • Extract setup code for the test suite into a test/setup.js file
  • Introduce a mocha.opts configuration file for easier configuration of how the test suite runs
  • Commented each testing dependencies import and explained its role in the test suite

Structure

  • Abstract constants used across many tests, like key codes into support files for re-use
  • Introduce helper functions to perform tasks that are repeated throughout the test suite
  • Introduced common contexts for tests where possible
  • Moved setup code into beforeEach blocks of common contexts where possible
  • Separate out the testing of <Shortcuts /> into multiple files for easier navigation

Syntax

  • Use JSX rather than React.createElement and React.DOM
  • Abstract the use of React.findDOMNode to a single place, so it will be easier to swap out at a later point (I couldn't figure out how to remove the deprecated method completely)

Coverage

  • Extend the test suite to more completely describe the behaviour of the package based on execution paths in the code and test cases that illustrate important differences in behaviour in particular situations

Limitations

  • I could still not figure out the real role of the isolate prop through writing tests and reading the source code - this may be because of the way events are simulated in the test suite or something else I am not getting.
  • The test suite was extended to be description rather than prescriptive (it documents how the package seems to behave, not how it should necessarily behave). So it may encode some bugs as expected behaviour (because I am unclear about the intended behaviour in some situations).

Conflicts

  • This pull request does cover most of the changes made in Update example, tests and dependecies for react 16 support #43. I used it (and the review comments) as inspiration in refactoring some of the test suite. It does not completely obviate the changes made in that pull request, however, as no changes to the source code has been made in this pull request.

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.

None yet

1 participant