Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Step 11: Add a unit test with Jest

As part of our new framework we have introduced Jest to allow us to write JavaScript unit tests. All components are required to have a test file with coverage for all emitted events, all methods and a snapshot. We are going to create our test file Ping.spec.js in the following directory client/component/local_quickstart/src/tests/unit/pages/.

The test below currently just creates a snapshot which allows us to easily track changes.

client/component/local_quickstart/src/tests/unit/pages/Ping.spec.js

...

languagejs

...

Please see our documentation on testing frontend code here.

To run the tests we run the following the command:

...