UNPKG

nodeunit-mock

Version:

A helper to allow you to mock out methods in a single nodeunit test without affecting the rest of the tests.

19 lines (14 loc) 395 B
"use strict"; var mock = require(".."); var PropertyMockTests = module.exports; // Test object for mocking out properties var testObject = { someProperty: 2 }; PropertyMockTests["Success"] = function(test) { test.expect(2); var prop = mock(test, testObject, "someProperty", 35); test.equal(testObject.someProperty, 35); test.equal(prop.callCount, 1); test.done(); };