Writing unit tests with JavaScript