Move tests to separate spec files and squash undef jshint warnings