I am just wondering if there is a way to simulate a "no connection" event in a mocha unit test. I have a method that return a promise that should wait for an internet connection with a polling strategy and I want to test it out with mocha. There is a method to achieve such a result.
Some code:
it('should wait for connection', function(done)
{
this.timeout(2500);
//simulate an internet connection drop here
my_object.wait.connection().then(done);
setTimeout(//activate connection, 2000);
});
Thank you for any response.
Aucun commentaire:
Enregistrer un commentaire