unit test with XMLHttpRequest not working