adopted unit test to work with phantomjs