DRYed out JavaScript tests