mercredi 13 mars 2019

In Mocha can I assert that a request times out?

I'm testing / confirming some DB lock stuff, and I want to stand up a test that'll confirm that the request ("request-promise" library) will hang if I lock the row.

Some ideas that didn't work were

request(options).catch((response) => {})

assert.throws(fn, Error, "timeout")

I continue to receive this message: Error: Timeout of 10000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.

Is there a way to assert that this timeout happens?

Aucun commentaire:

Enregistrer un commentaire