Added multiple JS test

Added two scripts to JS test.
fix tests and refactor a bit