Added npm tests and updated code style