1.0.1 • Published 7 years ago

must-return v1.0.1

Weekly downloads
1
License
MIT
Repository
github
Last release
7 years ago

must-return

Add function return value assertions to Must.js

Install

npm install must-return

Usage

require("must-return"); // This will internally require must and upgrade its prototype.

const return100 = () => {
    return 100;
};

describe("Testing must returns", () => {
    it("must be a huge success", () => {
        return100.must.return(100);
    });

    it("will fail", () => {
        return100.must.return("100");
    });
});

Note

Value comparison is done with ===, so in most cases you won't be able to test expected object return, as references will be different. I'm still new to Must.js and I'm looking for a way to make return to be a pass-through, just like resolve, so you will be able to do return100.must.return.eql({}) (looking for smoother to read naming too).

Feel free to suggest something or even open a PR.

License

MIT