Created
October 2, 2016 01:02
-
-
Save ericelliott/5c17e25731f658c80fd88cdf78740f6c to your computer and use it in GitHub Desktop.
Dependency Injection
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
const consumer = dependency => dependency.doSomething(); | |
const realDependency = { | |
doSomething () { | |
console.log('did something!'); | |
} | |
}; | |
consumer(realDependency); | |
const mockDependency = { | |
doSomething () { | |
console.log('did something else!'); | |
} | |
}; | |
consumer(mockDependency); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment