Last active
March 7, 2018 15:23
-
-
Save philipisapain/83b7bef727ba404fff05fa79385666f5 to your computer and use it in GitHub Desktop.
Testing an exported Node process with a dependency
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 SomeDependency = require('some-dependency') | |
const { TopLevelProcess } = require('./topLevelProcess') | |
describe('Stubbing a dependency passed to a constructor in an exported Node process', () => { | |
it('works as you would expect', () => { | |
const stubbedDependency = stub(new SomeDependency()) | |
new TopLevelProcess(stubbedDependency).start() | |
expect(/* something to have happened when `start()` is called */) | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment