Unit testing javascript