Jump to content
Slate Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate Marble
Slate Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate Marble
Sign in to follow this  
Rss Bot

How to test React sites and apps

Recommended Posts

If you want to know how to test React, you're in the right place. Do you really know your code does what it is supposed to do? Have you tested it in the browser? What if you haven’t, or you can’t test everything, and it breaks in production?

A testing library is a group of utilities developers use to write individual tests on application components. Some of the principle parts of a test are:

  • Description: describes what the test is about
  • Use/Render: uses the component in an environment where it can be tested
  • Mocking: creates pretend functions, so that you can check your assumptions

Over the course of this article, I’m going to explore some examples from the React Testing Library in order to help you get started with this valuable way of improving the robustness of your code output, as well as ensuring your code doesn’t throw up any nasty surprises once it goes into production.

Want more useful resources? Here's our rundown of the best web design tools around that'll help you work smarter. Or if you need a new machine, try this roundup of the best laptops for programming.

This content originally appeared in net magazine. Read more of our web design articles here

Read more:

View the full article

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×