Skip to main content

Posts

Showing posts from November, 2020

Unit test and CI

  Starting... This lab is to help our codes to make sure working well. Instead of manual testing for our functions, there are a lot of automatic test framwork for any languages. Since I used node js for my application, I chose jest since it looked very convenient and easy for me . Progressing... Jest,  link , is great test frame work since it provides more than mocha and I heard it is maintained by facebook... but not sure. To use this, I installed it as a development package and simply put some scripts such as test and test:coverage.  To be honest, for me it was not really easy as what I have heard. I need to understand the mocking function or fake implementation which made me so confused when I met it at first such as jest.fn() and mockImplementation(). To be honest, I am not a fan of test cases yet, I really have no idea for some parts how to test maybe I need more time to be familiar with it. Moreover, I think I should have not implemented the current way like a lot o...

Local Authentication

  Release 0.3.2 I tried to find a test issue to learn how to write test cases but I found another one which was also very interesting to me since it was about authentication set up using JSON web token. When I reviewed telescope, I read a code very carefully so I remembered about passport so I suggested that I would work with passport local and token and the owner agreed with my idea. First, for this I needed to understand passport and how JSON token works. After spending a lot of time, I implemented the part and commit it. The owner was satisfied with work but unfortunately, during the time, about 2 days, he decided to change main language from javascript to typescript due to typeorm. What is typeorm? It will be my next topic. Anyway, he liked my logic so he said he would use it. Ah~, there are many things I need to study. Since my second job was refused and wanted to study or contribute more especially about test case, I started to explore again and finally, I found one. And I le...

Elastic search and more

  Release 0.3.1 Now it is time to learn what is Elastic search since the chosen issue is about adding more fields for our model in telescope.  This is very new for me so I was very scared when I started to work for this but now I think I am more confident. First, Elastic search is such a great supportive database especially for index search. The good thing is that it is not only the index search for whole value but, partial keyword as well. Of course, it may be wrong since I also just started to study it. Anyway, It was very careful when I read codes one line by one. Following the official document ,  I tried to add some fields, but it made some test failed so I needed to fix them. The below content is from the official document: Mapping edit Mapping is the process of defining how a document, and the fields it contains, are stored and indexed. For instance, use mappings to define: which string fields should be treated as full text fields. which fields contain numbers, dat...

Coding Standard

  Starting... This lab is to help our codes to standardize automatically. As you have experienced a lot, group coding is very difficult to be unified in one specific style. In this lab, we will explore how to make one style code with very efficient or effective libraries, prettier and lint for node js . Progressing... Prettier,  link , is great for matching our coding style especially indent with tab or space, how many line and so on. The first step I took is to install prettier and put simple scripts in package.json,   "prettier-fix": "prettier --write \"./**/*.{md,js,json}\"",  "prettier": "prettier --check \"./**/*.{md,js,json}\"". I just run the script and I realized that there were a lot of prettier issues like indent, different ending style, tab, space and so on. Luckily, these scripts were very helpful since it provided auto editing features as well so I did not have to modify following the rules manually.   Eslint,  li...

Working with telescope

   Starting... This lab is to help students to communicate with a big project, telescope, and understanding how to handle with the set it up. There were a lot of trouble since many of technologies are new for me such as docker, docker-compose, elastic search ladis, pino, and so on. Let's jump in the big project . Progressing... The first step I took is to install wsl 2. It is not very difficult since microsoft provides good instruction, link . Although the telescope provides very good instruction,   here , It was not really easy for me to get a concept and set it up successfully. Therefore, I needed to ask a lot of questions on slack, telescope channel. Some helped me a lot and explained so much and finally I got it work successfully.  After my server was working locally, I didn't have any issue to get the response from the url, http://localhost:3000/posts.  To communicate with the local server, actually I needed to change my code a lot since I wanted to sp...