{"id":21020,"date":"2024-05-14T12:20:32","date_gmt":"2024-05-14T12:20:32","guid":{"rendered":"https:\/\/pl.server2.purelogics.net\/?p=21020"},"modified":"2024-06-06T08:50:02","modified_gmt":"2024-06-06T08:50:02","slug":"react-test-driven-development","status":"publish","type":"post","link":"https:\/\/pl.server2.purelogics.net\/?p=21020","title":{"rendered":"From Idea to Implementation: Test-driven Development with React"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_65 counter-hierarchy ez-toc-counter ez-toc-light-blue ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title \" >Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/pl.server2.purelogics.net\/?p=21020\/#Overview_of_Test-driven_React_App\" title=\"Overview of Test-driven React App\">Overview of Test-driven React App<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/pl.server2.purelogics.net\/?p=21020\/#Wireframe\" title=\"Wireframe&nbsp;\">Wireframe&nbsp;<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/pl.server2.purelogics.net\/?p=21020\/#Project_Setup\" title=\"Project Setup&nbsp;\">Project Setup&nbsp;<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/pl.server2.purelogics.net\/?p=21020\/#Configuring_CSS\" title=\"Configuring CSS\">Configuring CSS<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/pl.server2.purelogics.net\/?p=21020\/#Shallow_Render_Test\" title=\"Shallow Render Test\">Shallow Render Test<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/pl.server2.purelogics.net\/?p=21020\/#App_Component\" title=\"App Component\">App Component<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/pl.server2.purelogics.net\/?p=21020\/#Including_App_CSS\" title=\"Including App CSS\">Including App CSS<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/pl.server2.purelogics.net\/?p=21020\/#Including_the_Timer_Component\" title=\"Including the Timer Component\">Including the Timer Component<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/pl.server2.purelogics.net\/?p=21020\/#Timer_Shallow_Rendering_Test_Writing\" title=\"Timer Shallow Rendering Test Writing\">Timer Shallow Rendering Test Writing<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/pl.server2.purelogics.net\/?p=21020\/#Building_the_Timer_Component\" title=\"Building the Timer Component\">Building the Timer Component<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/pl.server2.purelogics.net\/?p=21020\/#Adding_Timer_CSS\" title=\"Adding Timer CSS\">Adding Timer CSS<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/pl.server2.purelogics.net\/?p=21020\/#TimerButton_Shallow_Rendering_Test_Writing\" title=\"TimerButton Shallow Rendering Test Writing&nbsp;\">TimerButton Shallow Rendering Test Writing&nbsp;<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-13\" href=\"https:\/\/pl.server2.purelogics.net\/?p=21020\/#TimerButton_CSS\" title=\"TimerButton CSS\">TimerButton CSS<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-14\" href=\"https:\/\/pl.server2.purelogics.net\/?p=21020\/#Refactoring_the_Timer\" title=\"Refactoring the Timer\">Refactoring the Timer<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-15\" href=\"https:\/\/pl.server2.purelogics.net\/?p=21020\/#Wrapping_Up\" title=\"Wrapping Up&nbsp;\">Wrapping Up&nbsp;<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-16\" href=\"https:\/\/pl.server2.purelogics.net\/?p=21020\/#About_PureLogics\" title=\"About PureLogics&nbsp;\">About PureLogics&nbsp;<\/a><\/li><\/ul><\/nav><\/div>\n<span class=\"rt-reading-time\" style=\"display: block;\"><span class=\"rt-label rt-prefix\">Reading Time: <\/span> <span class=\"rt-time\">8<\/span> <span class=\"rt-label rt-postfix\">minutes<\/span><\/span>\n<p class=\"wp-block-paragraph\">Writing test cases under TDD with React projects is often easy, particularly given Jest and Enzyme as testing tools. However, there are some specific factors that one needs to bear in mind.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Here at PureLogics, our JavaScript expert developers go through the React TDD process and demonstrate it step by step, from the epics and user stories to the development and production.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In this article, we will explain to you how to develop a React application with a focus on test-driven development (TDD), starting with creating the user stories and moving into development. For the purpose of following the TDD practices, we\u2019ll be testing the code using Jest and Enzyme libraries. By the end of this guide, you&#8217;ll be able to:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Generate epics and user stories depending on the project outlined.<\/li>\n\n\n\n<li>As a QA, develop test cases based on these user stories.<\/li>\n\n\n\n<li>Create a React app with an emphasis on Test-Driven Development.<\/li>\n\n\n\n<li>Test the React components using Enzyme and Jest.<\/li>\n\n\n\n<li>Extensive use of CSS variables is required to ensure responsive designs.<\/li>\n\n\n\n<li>Use React to build an adaptable component capable of rendering and performing action accordingly to set PROP values.<\/li>\n\n\n\n<li>Use the following REACT tool to perform type checking on component props: React PropTypes.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">This tutorial presumes you have a basic knowledge of React.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Overview_of_Test-driven_React_App\"><\/span>Overview of Test-driven React App<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">We are going to build a Pomodoro cheater app with a really simple layout and a set of UI components, and every component will have its own test file with a set of tests. First of all, we will decide on epics and user stories in accordance with the requirements of a certain project.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong>Epic<\/strong><\/td><td><strong>User Story<\/strong><\/td><td><strong>Acceptance Criteria&nbsp;<\/strong><\/td><\/tr><tr><td>Being a user, I require to utilize the timer to manage my time.&nbsp;<\/td><td>I require the ability to initiate the timer in order to track the duration of my time.<\/td><td>Ensure the user can:<br><br>*start time<br>*view the count down&nbsp;<br><br>The countdown should continue uninterrupted even if the user clicks the start button multiple times.<\/td><\/tr><tr><td><\/td><td>I require the ability to pause the timer so that I can choose when to start counting down my time.<\/td><td>Ensure the user can:<br><br>*Stop the timer&nbsp;<br>*Display the stopped timer<br><br>No action should be taken if the user clicks the stop button multiple times.<\/td><\/tr><tr><td><\/td><td>I require the ability to reset the timer so that I can start counting down my time from the initial duration.<\/td><td>Ensure the user can:<br><br>*reset the timer<br>*display the timer<br><br>Resetting to the default duration.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Wireframe\"><\/span>Wireframe&nbsp;<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"576\" src=\"https:\/\/pl.server2.purelogics.net\/wp-content\/uploads\/2024\/05\/inside-1-1024x576.jpg\" alt=\"wireframe\" class=\"wp-image-21024\" srcset=\"https:\/\/pl.server2.purelogics.net\/wp-content\/uploads\/2024\/05\/inside-1-1024x576.jpg 1024w, https:\/\/pl.server2.purelogics.net\/wp-content\/uploads\/2024\/05\/inside-1-300x169.jpg 300w, https:\/\/pl.server2.purelogics.net\/wp-content\/uploads\/2024\/05\/inside-1.jpg 1200w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Project_Setup\"><\/span>Project Setup&nbsp;<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">To start, we&#8217;ll use Create React App to set up our React project as follow:<\/p>\n\n\n\n<figure class=\"wp-block-image wp-duotone-rgb000-rgb151248207-1\"><img decoding=\"async\" src=\"https:\/\/lh7-us.googleusercontent.com\/eyTEYDG5zDdMEzYET3W_OTO4xKFzDZ-Ey72OApuZO26JDNT-yeHYd0SclcYjv3qm1KjnW9om7M3V167qGWBqtRVHQ4CjSL0JdG9hvk1RUllagMAVdEo5US4Q27sYoPiej4MSLZdzwnUuesJcmDMpUNw\" alt=\"\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">After running Create React App, a new browser tab will open. You can stop the React app by pressing Ctrl+C in the terminal.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Next, we&#8217;ll add Jest and Enzyme, along with some dependencies as follow:&nbsp;<\/p>\n\n\n\n<figure class=\"wp-block-image wp-duotone-rgb111-rgb151248207-2\"><img decoding=\"async\" src=\"https:\/\/lh7-us.googleusercontent.com\/SS76rQfRWcPxbcYXh-KK3Qtf1Yndn7HnsRVUJmTPTzCsYeJERVZbuIEM0FMD7Z1ZTRaEZy56-HZkwlitqLLdLh2ejn_uxpUkhj_9I_L9h8YiAIFm4O51UV7cEVKVLikt0jCC3_Vr9b50vRMONYM6Nig\" alt=\"\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Additionally, we&#8217;ll add or update a file named setupTests.js in the src directory:<\/p>\n\n\n\n<figure class=\"wp-block-image wp-duotone-rgb111-rgb151248207-3\"><img decoding=\"async\" src=\"https:\/\/lh7-us.googleusercontent.com\/VS5DzSEFmbEK-0mGXkKd1A2SnxGMLM40ps0I08OXYFMYc-b9P7uJypBuJeT_eyTcQB9pGK1Uixm6fMJ4mLRRWpfkydDVOQGsRmW2fH7WPsw6ZA5mdV2oLC1xJPog9AX8ogX09y1NYqzcxRiP3ceb5mQ\" alt=\"\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Create React App runs the setupTests.js file before each test, ensuring that Enzyme is properly configured for testing.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Configuring_CSS\"><\/span>Configuring CSS<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">To ensure our CSS variables are globally accessible, we&#8217;ll define them in the :root scope. Variables are declared using custom property notation, starting with &#8212; followed by the variable name.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Please open the index.css file and add the following code:<\/p>\n\n\n\n<figure class=\"wp-block-image wp-duotone-rgb111-rgb151248207-4\"><img decoding=\"async\" src=\"https:\/\/lh7-us.googleusercontent.com\/hfRJihAV0nKFCaVFb9IM3PiBD9kB8wk-2dXCW2h45oNuFNlfmbfZFBlS03X7IixBNtYb4pPf2i0VwMGhgPJ8HxIegTd8aXDLIWCHyv22wPJ40qdSunfbQXu9C8FzziALoeabhZEopc_PJOwoA5W4Wkg\" alt=\"\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Now, let&#8217;s import the CSS into our application. Update the index.js file as follows:<\/p>\n\n\n\n<figure class=\"wp-block-image wp-duotone-rgb111-rgb151248207-5\"><img decoding=\"async\" src=\"https:\/\/lh7-us.googleusercontent.com\/Sa0L2VGj0UfelQF0MYD43g8PP-g_8qeg5LyDtRbCg1RxlStuGbOIDTLUEcvBEHpmQ9jF2fqMF57JAgO6KAboGh6WIQEfsg9suvKW_8J4MrNkPVqATPaFRXOU3DAhjg-_1afLy8hhRRl7vKTsYLsXBJM\" alt=\"\"\/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Shallow_Render_Test\"><\/span>Shallow Render Test<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">As you may already be aware, the Test-Driven Development (TDD) process follows these steps:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Add a test.<\/li>\n\n\n\n<li>Run all tests, which should result in the new test failing.<\/li>\n\n\n\n<li>Write the code necessary to pass the test.<\/li>\n\n\n\n<li>Run all tests again.<\/li>\n\n\n\n<li>Refactor code if needed.<\/li>\n\n\n\n<li>Repeat the process for each new feature or improvement.<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">With this in mind, let&#8217;s add our first test for a shallow render test. We&#8217;ll then write the code to pass this test. Create a new spec file named App.spec.js in the src\/components\/App directory.<\/p>\n\n\n\n<figure class=\"wp-block-image wp-duotone-rgb111-rgb151248207-6\"><img decoding=\"async\" src=\"https:\/\/lh7-us.googleusercontent.com\/V261YalWsfvJ_KsSZ0kKllXxC9mmNRXOC9ftks91xM1T7m0oVckHQqcgEyZf61kpGlC5wdXyskZ9yMKmfsITM7o9N_AwC6z7ObMXK5X4IHTfIFD-E2iz5hHA7zAD1dbIL9xAqM_4TBsVVzCVmqdj3cg\" alt=\"\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">After adding the test, you can run it using your testing framework.<\/p>\n\n\n\n<figure class=\"wp-block-image wp-duotone-rgb111-rgb151248207-7\"><img decoding=\"async\" src=\"https:\/\/lh7-us.googleusercontent.com\/S30x6BiCvACWWhk6OZpwzgMioc60U9TdZ-wD364-Er4oaFlklNknGlbsC0qBlP0Cz4w-YPaG00qS8CdvgXPkXQoh_xYVrHoZpECRlUTwVwAJmWCvoZQbKv6LeURECBu105jTekj_ycv6zzBkiWT383Y\" alt=\"\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Running the test after adding it should result in a failure.&nbsp;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"App_Component\"><\/span>App Component<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Next, we&#8217;ll create the App component to pass the test. Navigate to App.jsx in the directory src\/components\/App and add the following code:<\/p>\n\n\n\n<figure class=\"wp-block-image wp-duotone-rgb111-rgb151248207-8\"><img decoding=\"async\" src=\"https:\/\/lh7-us.googleusercontent.com\/fH2HduhO9XLA9dHp1AxXdbI1sgwXrFIBl2K46t2s2A-hbASKxjuo7PbiX-YNWA0pKLlGanavO38Grr88MR2-Z2PEXAh0A0Nqizr3osDw2gpLf4Vhhk7A6kdGFDrp6tc5fLuLDUU25F_XxLOwuustz-8\" alt=\"\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Now, again run the test.<\/p>\n\n\n\n<figure class=\"wp-block-image wp-duotone-rgb111-rgb151248207-9\"><img decoding=\"async\" src=\"https:\/\/lh7-us.googleusercontent.com\/np3vwHkoK3-BIfk8ptB36KqAYEksj7SAt6oY1c5GyV3p2OKxD_KsEmm2hPwIkRKZUxhUFn2Zpfm3NFN-FFhcbI_YqCOzdfMtoyW9j057AHNM0-UeA_0WzLgfv3-dlG-mGiE1ltjbgVT6-U86F8OAEJA\" alt=\"\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The first test will pass this time.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Including_App_CSS\"><\/span>Including App CSS<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">To add some styling to the App component, we&#8217;ll create a App.css file in the directory src\/components\/App with the following content:&nbsp;<\/p>\n\n\n\n<figure class=\"wp-block-image wp-duotone-rgb111-rgb151248207-10\"><img decoding=\"async\" src=\"https:\/\/lh7-us.googleusercontent.com\/37M2D81c48zTLU73_rmwrirZcUklaI_3ixYKHzW9CFVAlWoTAlBGuCuZdlFlw6P8BJwwx0lK-JF5bRk95ZBwxr2ZKUg1cLCgeqOlC96zVNBKgRKAD6TTCy-Zv1z8-8eII_qo0CfFWPVtploVrck2cF4\" alt=\"\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Now, let&#8217;s import the CSS into the App.jsx file:<\/p>\n\n\n\n<figure class=\"wp-block-image wp-duotone-rgb111-rgb151248207-11\"><img decoding=\"async\" src=\"https:\/\/lh7-us.googleusercontent.com\/Jqtr0nLgrkegwmARn84-l2eVwGc4A-aG4k0F5UONMhyF1alakJlRRmDTzc508esfpydFMQEPi8VbSy-0SffvNUf2svO6dmD4aM0VMp2xN5pW4mg4BUWn_Sy_AVx-rPhs78WV5beXLsM6hiyw34F0ByU\" alt=\"\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Next, update the index.js file to import the App component:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full wp-duotone-rgb111-rgb151248207-12\"><img loading=\"lazy\" decoding=\"async\" width=\"935\" height=\"486\" src=\"https:\/\/pl.server2.purelogics.net\/wp-content\/uploads\/2024\/05\/Mastering-React-Test-driven-Development-Toptal\u00ae.png\" alt=\"\" class=\"wp-image-21043\" srcset=\"https:\/\/pl.server2.purelogics.net\/wp-content\/uploads\/2024\/05\/Mastering-React-Test-driven-Development-Toptal\u00ae.png 935w, https:\/\/pl.server2.purelogics.net\/wp-content\/uploads\/2024\/05\/Mastering-React-Test-driven-Development-Toptal\u00ae-300x156.png 300w\" sizes=\"auto, (max-width: 935px) 100vw, 935px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Including_the_Timer_Component\"><\/span>Including the Timer Component<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Finally, our app will include the Timer component. Therefore, we&#8217;ll update the App.spec.js file to ensure the Timer component is present in our app. Additionally, we&#8217;ll declare the container variable outside the first test case since the shallow render test needs to be performed before each test case.<\/p>\n\n\n\n<figure class=\"wp-block-image wp-duotone-rgb111-rgb151248207-13\"><img decoding=\"async\" src=\"https:\/\/lh7-us.googleusercontent.com\/dPqyIGhygC-3yj93VxTGDEXIi0Erka0tJn0Uq3fndU3NGjMuMPZJcMYe5UhQia8oaDRbCM6fZnwSgAF7REz5q6mZN4AHtOc_pesaJpOZOP7bwKcOFJqOvQhllEkAIRL_gJOb1xd-BeA1LrkL70D77OQ\" alt=\"\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">If you run npm test at this stage, the test will fail because the Timer component has not been created yet.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Timer_Shallow_Rendering_Test_Writing\"><\/span>Timer Shallow Rendering Test Writing<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Now, let&#8217;s form a file titled Timer.spec.js in a new directory lablled Timer below the src\/components directory.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We&#8217;ll also add the shallow render test in the Timer.spec.js file:<\/p>\n\n\n\n<figure class=\"wp-block-image wp-duotone-rgb111-rgb151248207-14\"><img decoding=\"async\" src=\"https:\/\/lh7-us.googleusercontent.com\/DEI5KAGTpGA94ofTEXHysrthJuyeJsYICFnt9Hiey82gGXtAFo_hIz-d7HOZtoSL4lZv5wSPu9OPIFsDQtPFMGaYP4-oBY3Xm3hCrpZ6IKw3ZTo1XZIEBsF8aimdGIn5tH_9l2rdRUQkBSfYczw0hoY\" alt=\"\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">As expected, the test will fail.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Building_the_Timer_Component\"><\/span>Building the Timer Component<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Next, let&#8217;s create a new file called Timer.jsx and define the necessary variables and methods based on the user stories:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large wp-duotone-rgb111-rgb151248207-15\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"907\" src=\"https:\/\/pl.server2.purelogics.net\/wp-content\/uploads\/2024\/05\/image_2024_05_14T12_58_56_881Z-1024x907.png\" alt=\"\" class=\"wp-image-21045\" srcset=\"https:\/\/pl.server2.purelogics.net\/wp-content\/uploads\/2024\/05\/image_2024_05_14T12_58_56_881Z-1024x907.png 1024w, https:\/\/pl.server2.purelogics.net\/wp-content\/uploads\/2024\/05\/image_2024_05_14T12_58_56_881Z-300x266.png 300w, https:\/\/pl.server2.purelogics.net\/wp-content\/uploads\/2024\/05\/image_2024_05_14T12_58_56_881Z.png 1350w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">This will pass the test and render a &lt;div \/&gt; in the Timer.spec.js file. However, the test should not render the Timer component yet, as we haven&#8217;t added the Timer component to the App component.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To add the Timer component to the App component, update the App.jsx file as follows:<\/p>\n\n\n\n<figure class=\"wp-block-image wp-duotone-rgb111-rgb151248207-16\"><img decoding=\"async\" src=\"https:\/\/lh7-us.googleusercontent.com\/uTIZpNbUUc7VK8Uw4bNJWkKbeuikBn7JN_z2NamW--35Uyci25WC6F009Vnvvyu7chwSeM4rOI-KOVq3DMFhmI-xkk80jvHJJ86Nbl9-Ox2xdkcjJukFUFdkzmIZXBjdc0My59bV-zr1k_A68YDyIJ0\" alt=\"\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">All tests should pass now.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Adding_Timer_CSS\"><\/span>Adding Timer CSS<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">To add CSS variables related to the Timer and include media queries for smaller devices, update the index.css file as follows:<\/p>\n\n\n\n<figure class=\"wp-block-image wp-duotone-rgb111-rgb151248207-17\"><img decoding=\"async\" src=\"https:\/\/lh7-us.googleusercontent.com\/xtPdGObrOjIz6Bhc6aPCfeB-JWHDZAZ5NlsPO5VWT473TuPKlDqREaAHj1sZc2TpMLJ-CBnx3r8k__rZuMS8rMl97iZIuz7KsEuRCprQh1_hGRbzGGptEnZoOA8xrVUvpk5e1Pxs2xX42tIFiQ_uYG8\" alt=\"\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Additionally, let&#8217;s create the Timer.css file under the directory components\/Timer:<\/p>\n\n\n\n<figure class=\"wp-block-image wp-duotone-rgb111-rgb151248207-18\"><img decoding=\"async\" src=\"https:\/\/lh7-us.googleusercontent.com\/4lUAxM96qNQBp4gOkpk3o4FyP8tD5OZbUkTwLL4cBvUwH3PZsEPtuMrmv0KiOv0KHVsPtxV2NUKxhSLWgM6WEjncvvWopc7R3QaZnSCfd4sGCRHnox2Lft5SDxzHxeWsamtO68dwjchJE9AewLwei6A\" alt=\"\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Update Timer.jsx to import the Timer.css file.<\/p>\n\n\n\n<figure class=\"wp-block-image wp-duotone-rgb111-rgb151248207-19\"><img decoding=\"async\" src=\"https:\/\/lh7-us.googleusercontent.com\/j-NFvdj95hn74s0JMx44cKtdpytM0FAFEo4t2mWcXvkfzMfqwqEOjmxIdTsryQHeiJvUoUiXNG5AEZhfw_H1DdAO_8xY6SBeX8JXTsIE3e8IDN8xvW9UOSoDeVWYgNB8GIap7HUlKuyVMkU2m4zmcLo\" alt=\"\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">If you run the React app now, you should see a simple screen with a border in your browser.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"TimerButton_Shallow_Rendering_Test_Writing\"><\/span>TimerButton Shallow Rendering Test Writing&nbsp;<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">For adding Start, Stop and Reset buttons we are going to create a TimerButton component.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">First, update Timer.spec.js file to look for TimerButton component in Timer component:<\/p>\n\n\n\n<figure class=\"wp-block-image wp-duotone-rgb111-rgb151248207-20\"><img decoding=\"async\" src=\"https:\/\/lh7-us.googleusercontent.com\/5JzXj2bD06EfkX2JiXrXGQLJq_eFhMqHDYJtVgwLUHoy5ThVQSjiDsi-Ty2Tdzg_o21PctsD3uqG_QB5eOLTHLZMGzO4fbi-VyAxQmImixQ475dfnGL_xl_wasRq0x1kf1PoH9aMaxARf1PjkYW2bZk\" alt=\"\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Now, let&#8217;s create the TimerButton.spec.js file in a new directory called TimerButton under the src\/components directory, and add the test to the file:<\/p>\n\n\n\n<figure class=\"wp-block-image wp-duotone-rgb111-rgb151248207-21\"><img decoding=\"async\" src=\"https:\/\/lh7-us.googleusercontent.com\/NhxRljJmY88BMgpHSMopoEmb-crGRVAI2lw8g-As1sGiNwcCtNQSbr7fs4n-0lmHwzn2FWB80x0mks7ggmCo9VduAaxHQZoAsoRo_hvx4PFsQlENlLw2tb_qPnmU2XdAkeuo0p3dpZvGIi9S89ZvCh0\" alt=\"\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">If you execute the test at this point, it will fail.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Let\u2019s create the TimerButton.jsx file for TimerButton element:<\/p>\n\n\n\n<figure class=\"wp-block-image wp-duotone-rgb111-rgb151248207-22\"><img decoding=\"async\" src=\"https:\/\/lh7-us.googleusercontent.com\/t6Tl8eWxracpDf9tDPDjqbkAdUAI0_DtYbww8qQUJDdUj8XWHHArca13TT-MnswyYhPZyheYmcnKoOi3R_DsTqFWJ8T4GRQdUEb_ibBsxCHQ9LBtIlZ8rPUJpQC_abXVuUGHu5B7No2IMggzC6hbMJ4\" alt=\"\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">If you execute npm test at this point, the test should render instances of the TimerButton component, but it will fail because we have not added the TimerButton components to the Timer component.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Let\u2019s import the TimerButton component and add three TimerButton components in the render method of Timer.jsx:<\/p>\n\n\n\n<figure class=\"wp-block-image wp-duotone-rgb111-rgb151248207-23\"><img decoding=\"async\" src=\"https:\/\/lh7-us.googleusercontent.com\/A0UIwPFCTgsyJLmOd75NfCuuIxF5jQUMPj8r9oZfL1oa33hSjKouz3v7knL3C6zexnIBMEaOKyV0EQZGcs0jV2M3Rt6w9qAUsNwlVAwfxb7PEdG2QkOpkDhT4jXb9ilMQLrQoYUz5JVMjYU5nIaXslI\" alt=\"\"\/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"TimerButton_CSS\"><\/span>TimerButton CSS<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Now, we add CSS variables for the TimerButton component. Add elements in the: root scope to the index.css file:<\/p>\n\n\n\n<figure class=\"wp-block-image wp-duotone-rgb111-rgb151248207-24\"><img decoding=\"async\" src=\"https:\/\/lh7-us.googleusercontent.com\/6EXcmV3aCKj01i44X5njyyJ4Kw8LjNdvhoCCQ06P6SFDjGvM5kb8Z6H6vMgpfncROEAWHA3d9CGO5fkH_xfTI3f2slKn8TEi2IlAZxR_egNQJ-BD8Pit1CyK2xUN8QCVsUjq8BONTKzPHwoJcPcTNM0\" alt=\"\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Also, create a file named TimerButton.css in the TimerButton folder in the src\/components directory:<\/p>\n\n\n\n<figure class=\"wp-block-image wp-duotone-rgb111-rgb151248207-25\"><img decoding=\"async\" src=\"https:\/\/lh7-us.googleusercontent.com\/yiDsfHwlb4vANvXFHmVKSiRha8niLnh3MwTHe3ucOHEMbNW50q_wApeoBnVycPtvrwC7ZGDCySomNfFkTjL6vOkUP9VRX3PuRZP5cntv6wnoMIpj6g9YY-CHbn760ZV5JNtvua8ATbZ5snKii7jnj6s\" alt=\"\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Now, let\u2019s update TimerButton.jsx to import the TimerButton.css file and display the value of the button:<\/p>\n\n\n\n<figure class=\"wp-block-image wp-duotone-rgb111-rgb151248207-26\"><img decoding=\"async\" src=\"https:\/\/lh7-us.googleusercontent.com\/dBqpU-fcbVfw2OeXMG2oIq7lEI3xm6gXg_-dUhWd7pfs7Mp21n46zMmyVQVNUn4DEcZqiMdQcPxjgFzWJmD5xdB53RhdAHo1e-5qzxS0926sIUIDblV5yy-O9ZJiCEX1T2uxJ3lKk55UgJt4CyqbeMw\" alt=\"\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Also, we should update the Timer.css file to display the three buttons in a row. Let\u2019s update the Timer.css file:<\/p>\n\n\n\n<figure class=\"wp-block-image wp-duotone-rgb111-rgb151248207-27\"><img decoding=\"async\" src=\"https:\/\/lh7-us.googleusercontent.com\/pCz2IFkEXDHeESAiKjwsb3WNWg_2Pl-eO-WiC0GioLAb4CYJDLLs8XXAc4hmo4lu_LBzC-ak1lL8TKisvJZHwe8mqvS77hnMw9BG9LYT9GCtiM4tQiL9t37-Wpj3bJOvBhqXGHCkRzfQ5RtOXvXmXv4\" alt=\"\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">If you try to run the React app now, you will see a screen like this:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"576\" src=\"https:\/\/pl.server2.purelogics.net\/wp-content\/uploads\/2024\/05\/inside-2-1-1024x576.jpg\" alt=\"\" class=\"wp-image-21023\" srcset=\"https:\/\/pl.server2.purelogics.net\/wp-content\/uploads\/2024\/05\/inside-2-1-1024x576.jpg 1024w, https:\/\/pl.server2.purelogics.net\/wp-content\/uploads\/2024\/05\/inside-2-1-300x169.jpg 300w, https:\/\/pl.server2.purelogics.net\/wp-content\/uploads\/2024\/05\/inside-2-1.jpg 1200w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Refactoring_the_Timer\"><\/span>Refactoring the Timer<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">If you stop right here and run the tests then, you will observe that the newly added tests fail yet since we didn\u2019t modify the TimerButton component. We keep on changing the TimerButton component to add the click event.<\/p>\n\n\n\n<figure class=\"wp-block-image wp-duotone-rgb111-rgb151248207-28\"><img decoding=\"async\" src=\"https:\/\/lh7-us.googleusercontent.com\/jPgmuqCV2fDyMrZv_hj0F_vy6Mxji3PpRKfjpxD6rO-5mWe8ggkBEYUazRaOgxOmHRsSQetBbpoW3QGSvCK4Mk8EuE5djXFaaBoaipq8G7YLA2EueSVEF3ZiWOEcFqItRi_tRFA8QYp33of3JEHqYMg\" alt=\"\"\/><\/figure>\n\n\n\n<figure class=\"wp-block-image wp-duotone-rgb111-rgb151248207-29\"><img decoding=\"async\" src=\"https:\/\/lh7-us.googleusercontent.com\/Eur3uAzbOYjQI4EyqBpMv2sH57Z7-EOAwaE3CJNK_SmMsGQHi7O8rgZAt1__tlCX5ImbAI3nYPQhIwVHyPNbWZt5VGokLtEEoo-WfLo0CAYfc574QQCr46ir8eDQM8pW-m5cIvfig8XCm-LriteZ390\" alt=\"\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">If you run the tests now, you&#8217;ll notice that the new tests fail because we haven&#8217;t yet updated the TimerButton component. Let&#8217;s modify the TimerButton component to include the click event.<\/p>\n\n\n\n<figure class=\"wp-block-image wp-duotone-rgb111-rgb151248207-30\"><img decoding=\"async\" src=\"https:\/\/lh7-us.googleusercontent.com\/MceFhGCciIpTRtn1m-PG4QQfkrJUHwL2sTcrO9mO1PU33HxXtVRY0mCd0ccyN1PldL0TfG2PrNoB6G6d_5rjFX7Rs7kmSoR9gnjoT0i3DpTmU_-qW26KCGjplB2XqjQt7qS1n1hJi3iJWJvNh5rn_Zw\" alt=\"\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Now the tests should work.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Next, we&#8217;ll add more tests to verify the state changes when each function is called in the mounted Timer test case:<\/p>\n\n\n\n<figure class=\"wp-block-image wp-duotone-rgb111-rgb151248207-31\"><img decoding=\"async\" src=\"https:\/\/lh7-us.googleusercontent.com\/F0tZZG7jutBd4nf7n2oaSqehBz0d8qRqjtbIS5xkRad9VZZTh8djXDENfxp-ylD1KY2pG8ZjLhsDaPPBFRkMLWC52fOzw3GqexA7l0FYCBZy4zjAGKEej5GrkF2MRJBodoua5olBixZLjKokWj_BG6Q\" alt=\"\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">If you need more context, imagine that when you are running the tests, they fail because we have not implemented each of these methods here. Let&#8217;s implement each function to make the tests pass:<\/p>\n\n\n\n<figure class=\"wp-block-image wp-duotone-rgb111-rgb151248207-32\"><img decoding=\"async\" src=\"https:\/\/lh7-us.googleusercontent.com\/0SufXvcnkW4wD0CK19U1H0-Ia7BDagcsf2aQkG4GYtxiP9QrqjzMwex1kBU0sRIn63qT5T63sAU67Q0rmtxkTnByJa53HlPyxcneeoc1M00dmFeN50nLXIDDOrhY_0FKlUDmLrfYEgk5aT8HD9hl9Gg\" alt=\"\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">If you have enough time to test the library, you will find the tests come out all right. Now, let\u2019s look at the last two steps and add the rest of the functions in the class Timer. jsx:<\/p>\n\n\n\n<figure class=\"wp-block-image wp-duotone-rgb111-rgb151248207-33\"><img decoding=\"async\" src=\"https:\/\/lh7-us.googleusercontent.com\/P23yFsDuoIqba4AIqiggej6_1WY6VBG3eD-lYssyAaGsf6qMcvDqgO5ZOXgXcaPV5rJ1aHQWtJHRyPmPi8zgE3OusJfgAeJOhZzpVBzOv8PELglZO-lz4w_kYESPOWO80qiOlfJnQmLSDRjrMNQ7rsM\" alt=\"\"\/><\/figure>\n\n\n\n<figure class=\"wp-block-image wp-duotone-rgb111-rgb151248207-34\"><img decoding=\"async\" src=\"https:\/\/lh7-us.googleusercontent.com\/FQRztx0Vfb34C9FVKQdz8zSAqUPAY9j8Joh-TYV-rCkSnAlg1fSL6vkXbp89bdgHChAdW4jIUC5hUv079nib5oLzDnpzc4C5Rh401z8-l8YG3VtTv78btBkjQYyEowaEpGMD5hTK2xHvAi91DWUnw2o\" alt=\"\"\/><\/figure>\n\n\n\n<figure class=\"wp-block-image wp-duotone-rgb111-rgb151248207-35\"><img decoding=\"async\" src=\"https:\/\/lh7-us.googleusercontent.com\/cYRL3JpEys_BcC7_laLLw-BvlV5GRSkjg31vGjTIPlv1Jhbf-FlRFg0dnzI8kfUNUw-Sjh3N0ZGdlWdXdOTtCv34P-vrxYQl5cGE4eAnrxt7rkGNd2TTl1kNzHqiG-WJIVvmyswXIIg7yzn2jBe7uhw\" alt=\"\"\/><\/figure>\n\n\n\n<figure class=\"wp-block-image wp-duotone-rgb111-rgb151248207-36\"><img decoding=\"async\" src=\"https:\/\/lh7-us.googleusercontent.com\/1a9nsX0B04Kv9TXTYJQptStj3mHlqNQztht-1XuuGEd3kEOWHjOfiwtalrMT1dyOpzbbAPJHj29SB38ZUbulxxl-1oEX6ujmN6yxiHymUQUsuTcZerPjmGW_4sw7CHjIp5br-9ux1naOcCQmsV_XJgU\" alt=\"\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Based on the user stories we created earlier, all functions are assumed to function as desired and will be tested accordingly.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"576\" src=\"https:\/\/pl.server2.purelogics.net\/wp-content\/uploads\/2024\/05\/inside-3-1024x576.jpg\" alt=\"\" class=\"wp-image-21022\" srcset=\"https:\/\/pl.server2.purelogics.net\/wp-content\/uploads\/2024\/05\/inside-3-1024x576.jpg 1024w, https:\/\/pl.server2.purelogics.net\/wp-content\/uploads\/2024\/05\/inside-3-300x169.jpg 300w, https:\/\/pl.server2.purelogics.net\/wp-content\/uploads\/2024\/05\/inside-3.jpg 1200w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">That&#8217;s correct! Following the principles of TDD we have created a rudimentary React app that fits within the parameters of the user stories identified. It means that an application under development will be thoroughly tested based on detailed user stories and acceptance criteria, which in turn will result in identification of more accurate test cases as a way of having the app work as desired.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Wrapping_Up\"><\/span>Wrapping Up&nbsp;<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">When planning the application with the TDD process, the project needs to be divided into epics or user stories, and acceptance criteria should be prepared. In this article, our specialists illustrated how a project can be deconstructed, and actual acceptance criteria for React TDD software development can be used.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">As mentioned earlier, there are a lot of resources available for React TDD but we thought putting up this taste of TDD development with React by using user stories might turn out to be somewhat useful.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"About_PureLogics\"><\/span>About PureLogics&nbsp;<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">PureLogics is the go-to partner for expert developers, programmers, architects, engineers, coders, and consultants. Companies and startups around the world hire talented developers from PureLogics for their key projects. Want something more personalized to your needs? Give us a <a href=\"https:\/\/pl.server2.purelogics.net\/contact-us\/\">call<\/a> and <a href=\"https:\/\/pl.server2.purelogics.net\/level-up-my-team\/\">level up your team<\/a> today!\u00a0<\/p>\n","protected":false},"excerpt":{"rendered":"<p><span class=\"rt-reading-time\" style=\"display: block;\"><span class=\"rt-label rt-prefix\">Reading Time: <\/span> <span class=\"rt-time\">8<\/span> <span class=\"rt-label rt-postfix\">minutes<\/span><\/span> Writing test cases under TDD with React projects is often easy, particularly given Jest and Enzyme as testing tools. However, there are some specific factors that one needs to bear in mind. Here at PureLogics, our JavaScript expert developers go through the React TDD process and demonstrate it step by step, from the epics and <a href=\"https:\/\/pl.server2.purelogics.net\/?p=21020\" class=\"more-link\">&#8230;<\/a><\/p>\n","protected":false},"author":11,"featured_media":21025,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[566,30],"tags":[],"class_list":["post-21020","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-remote-developers","category-software-developers"],"_links":{"self":[{"href":"https:\/\/pl.server2.purelogics.net\/index.php?rest_route=\/wp\/v2\/posts\/21020","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pl.server2.purelogics.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pl.server2.purelogics.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pl.server2.purelogics.net\/index.php?rest_route=\/wp\/v2\/users\/11"}],"replies":[{"embeddable":true,"href":"https:\/\/pl.server2.purelogics.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=21020"}],"version-history":[{"count":9,"href":"https:\/\/pl.server2.purelogics.net\/index.php?rest_route=\/wp\/v2\/posts\/21020\/revisions"}],"predecessor-version":[{"id":21629,"href":"https:\/\/pl.server2.purelogics.net\/index.php?rest_route=\/wp\/v2\/posts\/21020\/revisions\/21629"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/pl.server2.purelogics.net\/index.php?rest_route=\/wp\/v2\/media\/21025"}],"wp:attachment":[{"href":"https:\/\/pl.server2.purelogics.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=21020"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pl.server2.purelogics.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=21020"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pl.server2.purelogics.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=21020"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}