Last active
October 12, 2015 22:31
-
-
Save elicwhite/d4a576a8682e30d42c45 to your computer and use it in GitHub Desktop.
Test Private Functions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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