In this exercise, you would get history of events from an e-commerce website using an API returning JSON that looks like the following mocked file: test/history-api-mock.json
We expect you to make unit tests from test/index.spec.js pass.
Ue any online IDE you want (like GitPod).
Or on your locale machine:
Install Node.js
Install Git
Clone the project:
git clone https://github.com/OVNICap/JavaScriptTest
cd JavaScriptTestInstall dependencies: npm install
Modify/create files inside the src directory (you should not need to edit any other file to succeed).
Then fill the methods in src/analytics.js and add intermediate methods if it can help the readability of the code.
You can test your code using npm test
You can debug your code using src/index.js
and running npm start
Then create a pull-request on OVNICap/JavaScriptTest
Travis-CI will run tests, so you can check if everything works fine.
You should first try to get outputs of methods as close as possible to the values unit test expect.
We will take into consideration:
- the clarity of your code: variables names, indentation, comments;
- the optimization of the code: significant optimizations like caching results or reducing number of loops would be appreciated.