More tests, plus fixing a bug in JS generation