Jest is a javascript testing framework.
Lets build a simple application to test this
Install jest package as dev dependency

Now in test folder, we will be adding a simple test js file

Now in test folder, we will be adding a simple test js file
Here we created a file named phanidiscounts file in test folder.
The pattern for Jest is
describe() – what group we are testing and can have nested describes for each feature
and for main parent we can set some values in beforeEach() and afterEach() functions to execute something for once
And for child beforeEach() here it executes before each feature is completed. It means here after test() function we can set a value back and test() describes the test.
to run test, use npm run test in terminal

You can see all the tests are passed
Code in my github: https://github.com/pbndru/phani.jest