jeudi 24 mars 2016

How do I fail a Node unit test on the catch of a Promise?

I'm doing some unit tests using Node.js and I want to fail a test like this:

doSomething()
    .then(...)
    .catch(ex => {
        // I want to make sure the test fails here
    });

I'm using Assert, so I found Assert.Fails. The problem is that fails expects actual and expected, which I don't have. The Node documentation doesn't say anything about them being required, but the Chai documentation, which is Node compliant, say they are.

How should I fail a test on the catch of a promise?

Aucun commentaire:

Enregistrer un commentaire