vendredi 27 septembre 2019

Change Response After a Period of Time

I have a function that makes requests to a URL to check it's status. I need help testing it in Jasmine. Here's what I've tried:

jasmine.clock().install();
jasmine.Ajax.stubRequest(url).andReturn('working');
checkStatus(url, callback); // makes XHR requests to check status (should be 'working')
jasmine.clock().tick(5000);
jasmine.Ajax.stubRequest(url).andReturn('ready');
// callback should be invoked with status 'ready'
jasmine.clock().uninstall();

Aucun commentaire:

Enregistrer un commentaire