Testing React
Sat Jun 18 2022 09:25:25 GMT+0000 (Coordinated Universal Time)
Saved by
@patdevwork
// First create a .test.js file
// import the function that needs to be tested.
use jestjs.io for documentation how to test example below:
import timesTwo from "./functions"
test('Multiplies by two', () => {
expect(timesTwo(4)).toBe(8);
});
then run npm test to see if the test passed or failed
content_copyCOPY
Comments