structureed js for teatability and fixed broken test