Skip to content

Frontend Jest Testing

Nader Kutub edited this page Mar 29, 2024 · 8 revisions

While it is possible to test end-to-end user experience via RSpec feature tests, we can achieve better overall coverage (along with much better performance) by supplementing those with JS-specific tests using the Jest testing framework.

These should include (but are not necessarily limited to):

  • Unit tests of utility or other functions
  • Component testing that covers how a component renders, how a user might interact with it, and more

Basic Principles

  • Tests should be written in files that closely mirror the file structure of the code that is being tested. They should be nested in the same folder structure, and mirror the file names of those being tested — simply switch to .test.js as the file extension.
  • Here is a general guide on how use JEST
Clone this wiki locally