adding tests to local_spec.js and fixing some issues discovered in local.js #win for unit tests