Add test coverage

I created a qunit test suite. Open `test/index.html` to run it.