{"id":755,"date":"2022-12-19T14:23:25","date_gmt":"2022-12-19T06:23:25","guid":{"rendered":"https:\/\/www.tonghin.com.my\/blog\/?p=755"},"modified":"2022-12-19T14:23:27","modified_gmt":"2022-12-19T06:23:27","slug":"tough-tests-before-starting-the-stock-take","status":"publish","type":"post","link":"https:\/\/www.tonghin.com.my\/blog\/2022\/12\/19\/tough-tests-before-starting-the-stock-take\/","title":{"rendered":"Tough Tests before starting The Stock Take"},"content":{"rendered":"\n<p>This week was mostly focused on developing test scripts for the Stow List UI and building the Stock Take UI. Stock Take is the new module on which we will concentrate in the coming days.<\/p>\n\n\n\n<p>The first thing I did this week was use Mr. Peter&#8217;s provided examples to write some test scripts. I created a script to verify that the Text Input resets to a blank state after an incorrect input. The test was more difficult than usual, and I ran into several problems while completing it. The fact that we are developing an asynchronous code is the primary cause of the difficulty, and it is often the reason why I am unable to locate the source of a particular fault.<\/p>\n\n\n\n<p>The next thing I had to do was mock the Dto, which was not easy. It should have functioned after that, but it did not. Moreover, I started debugging the test script with the code under test, but I failed to run a proper test. eventually, it was caused by the timer that\u00a0<em>I needed to stop the timer in order to finish my test successfully.<\/em><\/p>\n\n\n\n<p>After that, I was also unable to complete a separate test script that validated the &#8220;back&#8221; button. It took a lot of my time, and I did everything I could think of to mock the BackHandler, but it was difficult.  In the end, I got through by using &#8220;\/ @ts-ignore,&#8221; which tells the TypeScript compiler to disregard the line below it and skip over the error. And thus, the mock worked and did its job and I was able to finish my test successfully.<\/p>\n\n\n\n<p>Finally, I began to create the new layout for our new module. I designed the main UI components. For the first time, I used new components such as a SelectList and a checkbox. Next week, I&#8217;ll get the&nbsp;data&nbsp;from the API and continue working on the stock take, which has to be ready to go by the end of the week.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This week was mostly focused on developing test scripts for the Stow List UI and building the Stock Take UI. Stock Take is the new module on which we will concentrate in the coming days. The first thing I did this week was use Mr. Peter&#8217;s provided examples to write some test scripts. I created &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.tonghin.com.my\/blog\/2022\/12\/19\/tough-tests-before-starting-the-stock-take\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Tough Tests before starting The Stock Take&#8221;<\/span><\/a><\/p>\n","protected":false},"author":7,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[5],"tags":[23,33,3],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v15.7 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Tough Tests before starting The Stock Take | Tong Hin&#039;s Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.tonghin.com.my\/blog\/2022\/12\/19\/tough-tests-before-starting-the-stock-take\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Tough Tests before starting The Stock Take | Tong Hin&#039;s Blog\" \/>\n<meta property=\"og:description\" content=\"This week was mostly focused on developing test scripts for the Stow List UI and building the Stock Take UI. Stock Take is the new module on which we will concentrate in the coming days. The first thing I did this week was use Mr. Peter&#8217;s provided examples to write some test scripts. I created &hellip; Continue reading &quot;Tough Tests before starting The Stock Take&quot;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.tonghin.com.my\/blog\/2022\/12\/19\/tough-tests-before-starting-the-stock-take\/\" \/>\n<meta property=\"og:site_name\" content=\"Tong Hin&#039;s Blog\" \/>\n<meta property=\"article:published_time\" content=\"2022-12-19T06:23:25+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-12-19T06:23:27+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\">\n\t<meta name=\"twitter:data1\" content=\"2 minutes\">\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/#organization\",\"name\":\"TONG HIN MACHINERY\",\"url\":\"https:\/\/www.tonghin.com.my\/blog\/\",\"sameAs\":[\"https:\/\/www.youtube.com\/channel\/UC60EoxJMNbu8mV0LuEGfrBg\"],\"logo\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/#logo\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/www.tonghin.com.my\/blog\/wp-content\/uploads\/2020\/10\/web_logo_180_180.jpg\",\"width\":180,\"height\":180,\"caption\":\"TONG HIN MACHINERY\"},\"image\":{\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/#logo\"}},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/#website\",\"url\":\"https:\/\/www.tonghin.com.my\/blog\/\",\"name\":\"Tong Hin&#039;s Blog\",\"description\":\"Sharing About Technology\",\"publisher\":{\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":\"https:\/\/www.tonghin.com.my\/blog\/?s={search_term_string}\",\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/2022\/12\/19\/tough-tests-before-starting-the-stock-take\/#webpage\",\"url\":\"https:\/\/www.tonghin.com.my\/blog\/2022\/12\/19\/tough-tests-before-starting-the-stock-take\/\",\"name\":\"Tough Tests before starting The Stock Take | Tong Hin&#039;s Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/#website\"},\"datePublished\":\"2022-12-19T06:23:25+00:00\",\"dateModified\":\"2022-12-19T06:23:27+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/2022\/12\/19\/tough-tests-before-starting-the-stock-take\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.tonghin.com.my\/blog\/2022\/12\/19\/tough-tests-before-starting-the-stock-take\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/2022\/12\/19\/tough-tests-before-starting-the-stock-take\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"item\":{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/\",\"url\":\"https:\/\/www.tonghin.com.my\/blog\/\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"position\":2,\"item\":{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/2022\/12\/19\/tough-tests-before-starting-the-stock-take\/\",\"url\":\"https:\/\/www.tonghin.com.my\/blog\/2022\/12\/19\/tough-tests-before-starting-the-stock-take\/\",\"name\":\"Tough Tests before starting The Stock Take\"}}]},{\"@type\":\"Article\",\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/2022\/12\/19\/tough-tests-before-starting-the-stock-take\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/2022\/12\/19\/tough-tests-before-starting-the-stock-take\/#webpage\"},\"author\":{\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/#\/schema\/person\/76160a63e513a3f2516d5e93e7f22cb8\"},\"headline\":\"Tough Tests before starting The Stock Take\",\"datePublished\":\"2022-12-19T06:23:25+00:00\",\"dateModified\":\"2022-12-19T06:23:27+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/2022\/12\/19\/tough-tests-before-starting-the-stock-take\/#webpage\"},\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/#organization\"},\"keywords\":\"asynchronous test,mock,tdd\",\"articleSection\":\"Experiential\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.tonghin.com.my\/blog\/2022\/12\/19\/tough-tests-before-starting-the-stock-take\/#respond\"]}]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/#\/schema\/person\/76160a63e513a3f2516d5e93e7f22cb8\",\"name\":\"Fadi Abdulrab\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/#personlogo\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/c69dd593cec65617923ff0c095266184?s=96&d=mm&r=g\",\"caption\":\"Fadi Abdulrab\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","_links":{"self":[{"href":"https:\/\/www.tonghin.com.my\/blog\/wp-json\/wp\/v2\/posts\/755"}],"collection":[{"href":"https:\/\/www.tonghin.com.my\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tonghin.com.my\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tonghin.com.my\/blog\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tonghin.com.my\/blog\/wp-json\/wp\/v2\/comments?post=755"}],"version-history":[{"count":2,"href":"https:\/\/www.tonghin.com.my\/blog\/wp-json\/wp\/v2\/posts\/755\/revisions"}],"predecessor-version":[{"id":762,"href":"https:\/\/www.tonghin.com.my\/blog\/wp-json\/wp\/v2\/posts\/755\/revisions\/762"}],"wp:attachment":[{"href":"https:\/\/www.tonghin.com.my\/blog\/wp-json\/wp\/v2\/media?parent=755"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tonghin.com.my\/blog\/wp-json\/wp\/v2\/categories?post=755"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tonghin.com.my\/blog\/wp-json\/wp\/v2\/tags?post=755"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}