Move tests to validators.js, update fix for #42