setting up javascript test runner and writing first tests

fixing first bug, discovered by tests