jeudi 27 juillet 2017

What should I do to test React app

currently I already finished my React project, but my supervisor needs to test with this instructions :

Tests are an essential part of our software engineering practices here and we’ll like you to include them as part of your submission.

I do not know what kind of test he want, but after I do some research, I got something related with Jest, and create a simple Jest code to test my react app this is the code : import React from 'react'; i

import ReactDOM from 'react-dom';
import AppDashBoard from './App';

it('renders without crashing', () => {
  const div = document.createElement('div');
  ReactDOM.render(<AppDashBoard />, div);
});

and the result are written in my terminal like this:

> jest

 PASS  src/App.test.js
 PASS  src/test/Link.test.js

Test Suites: 2 passed, 2 total
Tests:       2 passed, 2 total
Snapshots:   3 passed, 3 total

. So my questions : 1) Is this code is sufficient for submission as the instructions above ? 2) Which one I should submit to my supervisor ? Is it the code itself, or just a screeshot of the PASS message ? 3) I encounter a problem when I use npm test as Jest, the Jest cannot recognise my App's css file. The message error is pointing to the "." full stop when set the style of a class? Any idea ?

Thank you

Aucun commentaire:

Enregistrer un commentaire