initial rewrite of tests to js