Skip to content

jitendrak414/testing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Watch the video

Jest Testing – JavaScript Unit Testing Using Jest Framework

Visit GitHub!

[Git Hub!]: (https://github.com/jitendrak414/testing)

What does testing means?

testing means checking that our code meets some expectations

types of testing

unit testing integration testing UI testing

what is Jest?

JavaScript library for creating, running, and structuring tests. Jest is a JavaScript test runner Mostly Jest used with React

how do I know what to test?

??? Big Question "How do I know what to test?"

If you are try to writing web application 1. you should test all the pages 2. Every User interaction realated to page 3. pages are made from code having function and modueles

There is 2 things while writing your code

  1. legacy code which comes without tests
  2. implement a new functionality

Some Steps

  1. import the function to test
  2. give an input to the function
  3. define what to expect as the output
  4. check if the function produces the expected output

that's it. Testing won't be scary anymore if you think in these terms: input - expected output - assert the result.

Now hands on Jest!

Setting the project

mkdir block1 && cd $_
npm init -y

Install Jest
npm i jest --save-dev

Setting for browser error message

`npm install --save-dev jest-html-reporter`

test-driven development

So now pickup your phone and donate 2 beer bottle and some ammount for Laptop to work more. PhonePay me at 9319821922@ybl

Jitendra Kumar

About

React Testing

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published