This is a simple command-line Node.js application written in TypeScript.
yarn install
yarn build
yarn start
yarn test
Testing is achieved using the Jest framework. Currently, only the utils
directory is tested
which handles data manipulation.
Generally, testing user input is usually more complicated, but a good starting point for this could be a library I found which is node-mock-stdin.
Additionally, integration tests could also be developed.
One of the biggest challenges was to do with the descriptions of the data provided. The descriptions don't follow a
consistent syntax and so it was difficult to parse the data. I ended up using a few regex patterns that attempt to
parse the data in different ways until it finds a method that works.
Some of the descriptions also include HTML tags which I decided to strip out as this could be a security vulnerability
if this endpoint was compromised and used on a frontend system.
Thanks for the challenge - it was a fun one! :)