Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save philipisapain/83b7bef727ba404fff05fa79385666f5 to your computer and use it in GitHub Desktop.
Save philipisapain/83b7bef727ba404fff05fa79385666f5 to your computer and use it in GitHub Desktop.
Testing an exported Node process with a dependency
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