Add tests for #47
Move tests to validators.js, update fix for #42
Merge pull request #48 from ben-ng/master

Add unit test for #47