Sunday, 16 July 2017

Week 7 - Writing tests for the components

After designing the components, I started writing tests for them and also manipulating the components as per the tests requirements. In previous blog post, I mentioned that I have been started writing tests using mocha and chai. But due to some of the unwanted and unresolved errors, I consulted my mentor for setting up a proper testing environment. As per his suggestions, I decided to move forward with the Jasmine and karma testing environment. While setting up the jasmine and karma environment too, I faced a lot of errors. Some of them were :
"webpackJsonp not defined" which was resolved by using a part of the webpack in the karma.conf file ignoring the input, output and "vendor" part of the webpack.
After that I came across an error which was "transition superseded" error. It was quite difficult to overcome this error as there was no clue provided in the error log stack and when I went to search the solution for this error on the Google, I was getting a variety of solutions for that. Checking all of them was not feasible so I tried experimenting with the dependencies involved in the package.json file.
Fortunately, I tried to run the npm commands manually, and I got the solution to that error (a temporary solution) which eliminated some of the possibilities of the errors which was roaming into my mind at that moment. It gave me a sigh of relief. Its still an issue but a workaround exists and I am currently discussing with my mentor on this issue.
I have basically tested the REST part of the components (which is the main part) along with the functions I have used in the components. Tests ran successfully without any error !! :)

Apart from writing the tests, I also introduced a loading functionality into the components during the period they make the REST calls. This will help the users getting a better experience. It will be showing a loading gif (downloaded from the google) whenever the components will take time in providing the search results.

My next aim is to first discuss the solution of the error ("transition superseded") with my mentor and to resolve it as soon as possible. Then, I will move towards my next part of the project that is devising a way to use FHIR module into the webapp !!

Ankit Kumar

No comments:

Post a Comment