fix jshint in write.js
updated tests for write ctrl