Skip to content

Instantly share code, notes, and snippets.

@elicwhite
Last active October 12, 2015 22:31
Show Gist options
  • Save elicwhite/d4a576a8682e30d42c45 to your computer and use it in GitHub Desktop.
Save elicwhite/d4a576a8682e30d42c45 to your computer and use it in GitHub Desktop.
Test Private Functions
var privateState = require('private-state');
var sinon = require('sinon');
var utils = require('./utils');
describe('utils#getDateString', function() {
it('should print value from formatString', function() {
var stub = sinon.stub().returns('today');
privateState.setFunctionForTesting(utils, 'formatString', stub);
var now = new Date(2015, 1, 1);
var dateString = utils.getDateString(now);
assert.equal(dateString, 'today is today');
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment