Last active
February 17, 2020 16:05
-
-
Save keithstric/af57c019c19ec4abe201de668286e0f0 to your computer and use it in GitHub Desktop.
Adventures in Unit Testing 2
This file contains hidden or 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
const someFunction = require('./index'); | |
const rewire = require('rewire'); | |
let app; | |
beforeEach(() => { | |
someFunction(); | |
app = rewire('./index.js'); | |
}); | |
test('it should increment evtCount', () => { | |
const evtCount = app.__get__('evtCount'); | |
const somePrivateFunc = app.__get__('somePrivateFunction'); | |
somePrivateFunc(); | |
expect(evtCount).toEqual(1); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment