Add proper tests

Hi!

I really like this library, but it lacked proper tests. So I added some using Mocha/Chai, still run in a browser.

Thanks for your hard work!