What do I learn – Week 6

This week was more technical than all the others, more than a little essay of the topics that I learn, this week I want to share little notes of technical information and setup of IT projects, such like react test, GitHub features, and TypeScript express server. 

GitHub features 

GitHub is one of the leaders of version control systems for programmers, that’s why this platform has several tools for making that job easy, handling documentation, and team communication. 

One of the first is the project management tool integrated within the project tag, this provides a Kanban board with the typical headers of to-do, doing, review, and done. 

In order to use this tool more efficiently you have to open tickets for the requirements of the project in the issues panel, where you can link it to a project card, a person who is going to make the ticket, and a pull request when is done. 

Speaking of which, there is a complete set of tools to make code reviews on the pull request, having quick access to every single file changed in the request, and the ability to make comments to your mates about their code to improve it (or just for kudos their wonderful job). 

Example of code review panel

Finally, is the wiki section where you can write complete technical documentation for programmers of your project. How the components work and share useful information for future programmers. 

Basic unit testing React 

One of the most important things, when you make real-world apps, is to make them robust, and testing them in an automatic can help you to make sure you’re not breaking anything. 

I encounter testing the front-end a little trickier than other programs because of all the variables that are needed, and of course, the dependency and data from the backend. 

The main libraries to use to test the front end are called render and screen, and they are in @testing-library/react. 

First, you need to name your test case, then call the render method of the components or pages you want to test, and finally write the expected information from the screen

To run the tests the command is: react-scripts test or npm run test

Setup an express server with TypeScript 

There are several components in an API REST server in order to work properly. 

In fact, there all can be in the same file, but that is not a good practice because of the scalability and reliability of the project and also TypeScript is about strict datatypes in order to prevent mess up with different data input than expected. 

First, there should be a model of each element of the database with its rules (like their properties and functions like hash the password). 

Then are the services, where the CRUD functions of the called with the user input. 

But before making the endpoint is the scheme for the middleware where all the information is validated (like emails or minimum character required from an input). 

And finally, the route or endpoint where the client is going to call this request. 

Leave a Reply

Your email address will not be published. Required fields are marked *