#Middleware #Jest를 이용한 테스트코드
Today is the day to reflect using middleware and test code using Jest. Jest's retrospective records were organized based on personal study, and middleware was organized based on the use of personal projects.
Jest is one of the frameworks used to write test codes and is widely used in addition to JavaScript and React. Often, when writing a test code, it reduces bug time and helps to check whether the modified code is affected.
Although Jest was not used in this task, it plans to actively utilize Jest in the future.
Jest has five advantages, and has the characteristics of separating zero settings, snapshots, simulated objects, and test codes and simple APIs.
In brief, Jest aims for zero setting compared to other frameworks, and provides snapshot capabilities that can indicate errors when values change in large projects. In addition, changes to the rendered element are checked. I heard that the test code that was not performed in this task utilizes mocking, which plays a role in practically focusing on testing. It also has the advantage of separating fast performance and test code, and excellent API can be provided through code coverage.
As below, that is how to set up for Jest in terminal.
I found that descrive, it, and matcher (toEqual, toBeTruthy, toBeFalsy, toContain) are used as functions commonly provided in Jest, the first when comparing objects, the second and third when checking specific values in the array.
Middleware is a written term when configuring nodes and JavaScript servers, which reduces code duplication and makes it easier to read and analyze. When a client makes a request, the server processes the request and responds again, is an independent function for processing information, and is a module that enables the necessary functions to be executed sequentially.
As an express module included in the middleware, use() or next() is used as a representative example. It is used as a specific path to process on the server. It can also be added to the express middleware.
Middleware is a written term when configuring nodes and JavaScript servers, which reduces code duplication and makes it easier to read and analyze. When a client makes a request, the server processes the request and responds again, is an independent function for processing information, and is a module that enables the necessary functions to be executed sequentially.
As an express module included in the middleware, use() or next() is used as a representative example. It is used as a specific path to process on the server and is also added to the express middleware. The Express module has additional methods available along with requests and response objects used by existing http modules.
In addition, frequently used middleware includes "static" and "body-parser," and router objects are also used. Middleware that allows access to files in a specific folder is used as follows.
The body parser is used as middleware to request parameters in a post method, and the router is used to execute only functions that process the logic according to the pass requested by the client.
For reference, when an error occurs in the middleware and tries to handle it, the following method is used, and the following code is referred to through https://jinbroing.tistory.com/126.
what I have learned : 이번 심화주차 과제를 하면서, 완벽하게 끝낼 수 있을까에 대한 생각보다 어떻게 하면 기본 주차 때보다 더 완성도 있게 할 수 있을까에 대한 생각이 컸다. 그 마음이 가장 컸던 이유는 기본주차 때 사용할 수 있는 시간은 다 썼는데, 놓친 과제부분도 있었고, 제대로 된 마무리가 되지 않았기 때문이다. 비록 심화주차 과정에서도 테스트코드를 해 보지 못한 아쉬움이 가장 컸지만, 오늘 제스트라는 용어에 대해 배우면서 다음번에는 테스트 코드까지 마무리하고 싶은 생각이 들었다.
During this in-depth parking project, I thought about how to make it more complete than the basic parking rather than how to complete it perfectly. The reason why I felt the most was that I spent all the time I could use in the basic week, but there were some tasks I missed, and it didn't finish properly. Although I was most disappointed that I couldn't do the test code during the in-depth parking process, as I learned about the term Jest today, I wanted to finish the test code next time.
스파르타를 시작하면서 늘 생각은 똑같다. 만나는 사람마다 레벨이 다르고 생각이 다르고, 발전하는 속도도 다르다. 그러니까, 조금이든 한참이든 뒤처지더라도, 내게 주어진 기회만큼은 포기하지는 말자라는 생각으로 심화주차를 달려온 건 사실이지만, 1주차 때 함께 했던 팀원이 그만두었다고 얘기했을때, 다른 사람들은 그 팀원의 의견에 존중한다는 얘기만 할 뿐, 난 내 목소리가 쉬도록 설득만 하고 있었다. 아마도 그랬던 이유가, 나도 약간의 불안감을 느꼈고, 추후에 다른 사람들에게도 민폐를 끼칠까봐 걱정이 생겨서가 아닐까 싶다. 동시에, 공부하는 시간 만큼은 더 나빠지지도 말고, 나태해지지 말자고 마음을 먹었다. 앞으로 그룹 프로젝트 맡아서 실행할텐데, 나도 장담을 못하겠다. 잘할 수 있겠지?
As I started Sparta, I always think the same. Each person you meet has a different level, different thoughts, and different pace of development. So, it's true that I ran in-depth parking with the thought of not giving up the opportunity given to me even if I was lagging for a while, but when the team member I was with in the first week quit, others only said they respect the team's opinion, and I was persuading my voice to rest. Perhaps the reason for that was because I felt a little anxious, and I was worried that I would cause inconvenience to others in the future. At the same time, I decided not to get worse and not to be lazy as much as studying time. In the future, I will take charge of the group project and implement it, but I can't guarantee it either. I can do it, right?