Javascripts refactor and routing tests