lundi 17 octobre 2016

Workaround for Mocha async test timeouts

I'm trying my hand at writing unit tests with mocha and chai, however I'm running into an issue where I'm getting timeout errors instead of actual errors being thrown and I can't seem to find a workaround.

In my code I've made it that the opposite of what I'm testing for is true, so I have an expected failure.

Is there a standard way of fixing this sort of thing?

describe('Unit Tests for Networks Array\n', function () {

    it('should check that networks array is not empty', function (done) {
        git.getNetworks(function (networks) {
            expect(networks).to.be.empty();  // expected failure
            done();
        });
    });

Aucun commentaire:

Enregistrer un commentaire