0.1.4 • Published 6 years ago

327-tdd v0.1.4

Weekly downloads
-
License
MIT
Repository
-
Last release
6 years ago

327-tdd

** ALREADY NO LONGER MAINTAINED: see tdd-framework for another alternative.

Simple package that provides easy access to certain features of common TDD tools such a "global" sinon sandbox, sinon matchers, and chai expect with sinon-chai and chai-datetime included. See examples for further functionality.

Examples

var tdd = require("327-tdd");

// "global" sinon sandbox.
var sandboxedStub = tdd.sandbox.stub();
tdd.sandbox.restore();

// chai expect with sinon-chai and use of sinon match.
tdd.expect(sandboxedStub).to.have.been.calledWithExactly(tdd.match.func);

// proxyquire method.
var stubForProxyquire = tdd.sandbox.stub();
var moduleUnderTest = tdd.proxyquire("./module/path", { "moduleToStub": stubForProxyquire });

// Express tools and mocking
// reqMock && resMock return new instances of objects that have sinon mocked properties, they are not sandboxed as part of the tdd.sandbox.
var mockedReq = tdd.express.reqMock({ body: { name: "John" } });
var mockedRes = tdd.express.resMock();

NOTE: This NPM package was created to provide a standard, easy to use, TDD infrastrucutre for 327's development practices. There will be no support or consideration of requests from outside parties. But please feel free to use and abuse the package however you see fit.

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.0

6 years ago