Restructure client scripts with jasmine tests