Tests

To ensure the quality of you app, it is important to add automated tests. A test framework in included in the App to help you set it up.

Test examples

A dummy test is set up in test/unit/App.test.js to get you started:

it('Passes', () => {
  expect(true).toBe(true);
});

Snapshots

Jest allows to compare rendered React to saved snapshots to prevent breaking changes when modifying your app

const result = renderer.create(<PageHome
  dpapp=      {dpapp}
  history=    {history}
  location=   {{ state }}
  />
).toJSON();

expect(result).toMatchSnapshot();

This will create a snapshot of your rendered html in __snapshots__ that will prevent unexpected changes to applied. (You allows have the option to update a snapshot when running the tests when you do want to apply changes to the html).

Running the tests

You can run your tests by running:

> yarn test

Last updated