Cleaning Before The Nearly Done Update

At the beginning of this week, the main goals was to fix the bug that caused Views to render multiple times. And changing the style of the whole application by putting all of the styles into a single style file and using it on every page.

I followed the previous work to use the correct UseEffects and the render problem got addressed. I next went on to the pagination issue, where the list of items was inconsistent. And page pagination did not function at all. The bug was at the pagination function, so after I altered the function by using UseInterval solution, the problem is fixed. In addition, I started performing Async tests on the UseInterval function to have a better understanding.

After that I started to work on the styling because the application. The point of the style wasn’t the style itself, but rather to make it easier for me to make changes or style a component. The previous style was somewhat random, and each component was styled independently, which made the code more complicated. Therefore, the main purpose here was to clean the code and make the style easy to edit.

Next, I styled the main page and the primary background, in addition to all other components in the main pages. The result for me is great, now I can change any component style in only one place for all pages.

While Mr. Peter was testing the application before to this version’s upgrade, we discovered a bug again in the keyboard toggle. It took us some time to solve this problem, but after we did, Mr. Peter showed me how to make it a reusable component for our app, which was wonderful and helpful.

To conclude, the keyboard toggle were functioning properly with no bugs. However, it was not as we expected it to be, so we postponed the upgrade until the following week, when I will fix the issue.

Positive Test Cases and Positive Testing

Although the Flatlist obstacle was hard to define and took a long time to get solved. I’ve gained a greater understanding of testing and its flaws as a result. Therefore, I can follow the test progress and attempt to create the optimal assertion more quickly than previously.

This week, I started with testing the more page components. I tested the primary UI elements and the manual scanning functionality. I can state that my unit tests are imperfect and disorganized, but I am working to improve them each time, which affects my upcoming tests.

After that, I moved to test other views. They share comparable components, thus I did not encounter as many difficulties as before. Mr. Peter often urges me to write a good description, and I have since understood that the structure of my tests has to be improved and more understandable. Consequently, I separated my tests into several ‘describe’ sections. For instance, the ‘Header’ section only contains unit tests for the header components.

While you interact with some page, you can easily tell that something is going wrong with the manual scanning input field. Accordingly, I managed also to fix that and create a keyboard toggle that works as a controller to prevent the virtual keyboard from automatically appearing.

Overall, I learned more and gained new experience with unit testing. By running tests, I consistently encounter new errors that require new solutions and provide me with fresh knowledge. Next week, I will do negative tests on previously tested components. Fixing the extra rendering times problem for other views is another task as well.

The Headstrong Flatlist

Following what I did last week, I spent this week learning how to debug the code, using breakpoints more in the debugging. I tried to solve the fake-timers issue I had last week, by reading the react native docs. I dived more into testing asynchronous code, and learnt several ways to make the test effective. So I used async/await correctly to pass that.


The flatList component of react native was a major time-consuming task that I needed to test. Unfortunately, I spent a lot of time trying to solve the problem and I failed to resolve it. The error message given was always related to the testing configuration, which already set up and working successfully last week. Therefore, I considered changing the code and replacing the FlatList components with SectionList to avoid all of this, but it was not the perfect option.


Finally, in order to solve the aforementioned problem, I had to mock the FlatList at the end. it seemed quite impossible to test or to get an element form a FlatList unless it is mocked.

Babel Conflicts

This week, I began resolving dependency issues in order to rerun all test files and create new tests. There were several conflicts, so I reinstalled all jest and babel dependencies to address them. And this resulted in another failure to render the application due to Babel’s configuration and plugins.

The Error message was unclear, the code was difficult to follow.  This caused me to have greater difficulty troubleshooting the problem and discovering the bug, and it took me a significant amount of time to find a solution. I eventually had to separate the babel configurations for the application and the test files.

After that, I began to examine the test files and ensure that they ran properly. Numerous issues relating to Fake-timers and Mocks have appeared; I must solve them, ensure that existing tests are functional, and create new tests with no dependency conflicts or incorrect configurations.

Stuck in the Dependency Hell

This week, I was tasked with doing some test tasks, however, in order to complete them, I had to update a number of dependencies, which resulted in a large number of dependency conflicts.

My supervisor gave me the go-ahead to upgrade all dependencies and the react native version to the most recent version. It is not uncommon to discover several problems in the code and some dependency conflicts after getting done from the updates, which eventually I was able to resolve. Moreover, to modify the code and fix the errors, I had to spend some time reading the documentation for the new versions that I had upgraded.

Finally, with Mr. Peter’s assistance, the application ran properly on the emulator. Unfortunately, the testing dependencies still contain some errors, and Jest is unable to test the application. I have attempted a variety of solutions to resolve this issue, which will be resolved by next week.

In conclusion, this week was filled with dependencies updates and bug debugging. I’ve gained a lot of knowledge about how to handle the dependency conflict through much searching and reading, and from Mr. Peter of course. Now I must resolve the rest of the issues in the testing section so everything can be updated and work well.

First Testing Task

This week I started my first project-based technical task. I worked on writing a test file of a Pick function for the mobile app. During the process of testing I explored and searched for the following practices when performing this task.

I faced multiple hiccups during my search looking for solutions to the difficulties I had encountered during implementing an integration test. One of the problems I needed to handle is testing a function that uses an API, upon searching for solutions, I learned more about mocking and the way it works by isolating and only focusing on the code under test and sending the data without interacting with the API. Mr. Peter was a great mentor and helped me A LOT to get the job done.

The quality of the code I had at hand was not optimal and caused a lot of issues that I met when I was trying to test the code. In an effort to solve this, I learned how to debug the code by using the breakpoints points in Visual Studio Code which enable me to follow the sequence of the coding lines and give me the ability to pause the debugging process in order to check variables states and current value.

In conclusion, this week was full of learning and testing. I learned a lot during this week about testing and the steps that must be followed to do a unit test for a certain function. Learning how to utilize an important tool such as breakpoints was also beneficial and will aid me in my future testing efforts.

Second week at Tong Hin

After I had been familiar with the React Native and Typescript that we use in the current project. Mr. Peter helped me with installing and configuring the environment and the project on the computer. And it took some time because there were so many dependencies involved in the beginning.


Following that, I needed to look into the project files specially the testing  files and understand how that operates in order to carry on the testing later. Therefore, in order to begin learning how to test, you need to have an understanding of the concept of the AAA pattern. And That is how we structure a unit test by dividing each test into three sections — Arrange, Act, and Assert — with each section serving as a prerequisite for the next. The arrange phase puts up the input values for the test. The act phase initiates the primary tested function. And finally, the assert step ensures that the function’s output matches expectations.


After that, I got introduced to react testing library that we can implement a test using jets. Which is a test runner that identifies tests, executes them, and evaluates whether or not they passed or failed. I spent most of my time reading and gaining knowledge about testing, as well as putting several tests into practice.

My First Week at Tong Hin

My first week at the company was mainly focused on learning the technologies that I’ll be working on during my training. I spent the first day learning and refreshing my knowledge of Git. I learnt how to use Git by commands, creating repository, branches, committing, and how to deal with conflicts if occur.

Next, I dived into react native and react hooks. I managed to install the environment on my computer and I’ve solved few examples presented in the courses I followed.

Finally, I learned about TypeScript which I only heard of before, I learned the basic fundamentals about the programming language and I was introduced by my supervisor about the current project under development and the testing environment adopted to test the efficiency of the software.