Refactoring pin.js and implemented karma with gulp