Skip to content

azu/mocha-support-promise

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

mocha-support-promise example

Mocha 1.18.0 support promise tests!!

When, promise object testing

function getSuccessPromise() {
    return Promise.resolve(false);
}

Until now,

describe("OLD Promises Test Pattern", function () {
    context("with promise error handling", function () {
        it("should manually handling test...", function (done) {
            getSuccessPromise().then(function (value) {
                assert(value);
                done();
            }).catch(done); // when assert fail, it is needed.
        });
    });
});

From now,

describe("Promises", function () {
    context("when return promise object", function () {
        it("should support by mocha", function () {
            return getSuccessPromise().then(function (value) {
                assert(value);
            });
        });
    });
});

See example code @ test/.

License

MIT

About

Mocha 1.18.0 support promises test.

Resources

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages