Organizing Tests

In step with Joystick's strictly enforced file structure, tests are only recognized in your app if they're located in the /tests folder at the root of your app.

All test files must be named following the pattern <test_file_name>.test.js. Files that do not include a .test.js suffix will be ignored by the test runner.

Tests folder structure

While you don't have to, it's highly recommended that the contents of your /tests folder mirror the structure of the root of your project. So, tests related to a miscellaneous function in /lib should live at /tests/lib. Tests related to page components in your /ui folder should live at /tests/ui/pages.

Consider the following file structure:

-- /books
---- getters.js
-- slugify_title.js
-- /pages
---- /books
------ index.js

The /tests folder for this app might look like:

-- /api
---- /books
------ getters.test.js
-- /lib
---- /slugify_title.test.js
-- /ui
---- /pages
------ /books
-------- index.test.js

Test file contents

Each test file should only contain tests related to the mirrored path in the app. Each test file should be treated as a "suite" of tests (Joystick's testing paradigm does not offer an explicit suite() function or other means for organizing a suite of tests).