Fix broken JavaScript tests

Update tests to reflect changes made by #798, #765

Also remove a stray debug message.