-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: replace proxyquire with Symbol options
Since proxyquire does not support native ECMAScript Modules, inject mocks using Symbol properties on options. The symbols are shared from a module which is not exported from the package to avoid expanding the API in a way that would allow external callers to inject their own versions. Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
- Loading branch information
Showing
6 changed files
with
111 additions
and
33 deletions.
There are no files selected for viewing
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
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
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,43 @@ | ||
/** | ||
* @copyright Copyright 2021 Kevin Locke <kevin@kevinlocke.name> | ||
* @license MIT | ||
* | ||
* Package-private symbols. | ||
* This file is intentionally excluded from package.json#exports. | ||
*/ | ||
|
||
/** Symbol of mock function used in place of http.Agent for testing. | ||
* | ||
* @private | ||
*/ | ||
exports.HttpAgentMockSymbol = Symbol('HttpAgent'); | ||
|
||
/** Symbol of mock function used in place of https.Agent for testing. | ||
* | ||
* @private | ||
*/ | ||
exports.HttpsAgentMockSymbol = Symbol('HttpsAgent'); | ||
|
||
/** Symbol of mock function used in place of Octokit for testing. | ||
* | ||
* @private | ||
*/ | ||
exports.OctokitMockSymbol = Symbol('Octokit'); | ||
|
||
/** Symbol of mock function used in place of fetchCiStatus for testing. | ||
* | ||
* @private | ||
*/ | ||
exports.fetchCiStatusMockSymbol = Symbol('fetchCiStatus'); | ||
|
||
/** Symbol of mock function used in place of getProjectName for testing. | ||
* | ||
* @private | ||
*/ | ||
exports.getProjectNameMockSymbol = Symbol('getProjectName'); | ||
|
||
/** Symbol of mock function used in place of resolveCommit for testing. | ||
* | ||
* @private | ||
*/ | ||
exports.resolveCommitMockSymbol = Symbol('resolveCommit'); |
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
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
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