Preview:
// 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
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter