-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chapter 03: create a new fake that is ready to be configurable to use…
… in test
- Loading branch information
Showing
1 changed file
with
23 additions
and
0 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
chapter_03-using-stubs-to-break-dependencies/LogAn/fakeExtensionManager.js
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
function fakeExtensionManager() { | ||
/** | ||
* @type {boolean} | ||
*/ | ||
let valid = false; | ||
|
||
function willBeValid(value) { | ||
valid = value; | ||
} | ||
|
||
/** | ||
* @param {string} fileName | ||
*/ | ||
function isValid(fileName) { | ||
return valid; | ||
} | ||
|
||
return { | ||
willBeValid, | ||
isValid, | ||
}; | ||
} | ||
module.exports = fakeExtensionManager; |