Add Unit Tests

Add unit tests.

The tests are far from complete, but can easily be extended to more features by mostly copy and paste code from this PR.

Any comments are appreciated :+1: 

To run the unit tests, set up the environment by `npm install`, then run `npm test`. For doing just a single run rather than watching the files for changes, do `npm testonce`. This will be helpful for continuous integration.