buster-sinonΒΆ

Sinon.JS integration.

Sinon specific assertions are documented at buster-assertions.

Refer to the Sinon.JS documentation and do some guesswork for the other functionality.

Quick cheat sheet:

buster.testCase("Foo", {
    "test a stub": function () {
        // Overrides "aMethod" and restores when test finishes running
        this.stub(myLib, "aMethod");
        myLib.otherThing();
        assert.calledOnce(myLib.aMethod);
    },
    "test a spy": function () {
        // Wraps "aMethod". The original method is called, and you can also
        // do stub like assertions with it.
        this.spy(myLib, "aMethod");
        myLib.otherThing();
        assert.calledOnce(myLib.aMethod);
    }
});

And much, much more!

Related Topics

This Page