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

[TASK-1046] Add unit test for component #5120

Open
wants to merge 6 commits into
base: beta
Choose a base branch
from

Conversation

pauloamorimbr
Copy link

@pauloamorimbr pauloamorimbr commented Sep 19, 2024

Checklist

  1. If you've added code that should be tested, add tests
  2. If you've changed APIs, update (or create!) the documentation
  3. Ensure the tests pass
  4. Make sure that your code lints and that you've followed our coding style
  5. Write a title and, if necessary, a description of your work suitable for publishing in our release notes
  6. Mention any related issues in this repository (as #ISSUE) and in other repositories (as kobotoolbox/other#ISSUE)
  7. Open an issue in the docs if there are UI/UX changes

Description

This commit creates the base configuration and samples for adding unit tests with Jest.
Simple tests were created for the Button and KoboSelect3 components as samples.

Notes

  • Some new packages were added for jest to work
  • Configuration for jest was added into /jsapp/jest
  • 2 new scripts were created on package.json:
    • npm run jest
    • npm run jest-watch (Very useful when writing tests)
    • Both scripts can filter test files as in: npm run jest-watch -- Button
  • To avoid confusion with mocha .tests.* file, we're using the .spec.* extension for tests.
  • A test for the Button component was added checking for its interaction when enabled and disabled
  • A test for the KoboSelect3 component was added checking for its mouse and keyboard interaction

@pauloamorimbr pauloamorimbr changed the base branch from main to beta September 19, 2024 19:09
@pauloamorimbr pauloamorimbr marked this pull request as ready for review September 20, 2024 03:45
@pauloamorimbr pauloamorimbr changed the title [TASK 1046] Add unit test for component [TASK-1046] Add unit test for component Sep 20, 2024
Copy link

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.

1 participant