-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split code out into smaller functions and add tests
- Loading branch information
1 parent
68cfa35
commit a4807ee
Showing
10 changed files
with
921 additions
and
382 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
packages/gatsby/src/bootstrap/__mocks__/resolve-module-exports.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,19 @@ | ||
'use strict' | ||
|
||
let mockResults = {} | ||
|
||
module.exports = input => { | ||
// return a mocked result | ||
if (typeof input === `string`) { | ||
return mockResults[input] | ||
} | ||
|
||
// return default result | ||
if (typeof input !== `object`) { | ||
return [] | ||
} | ||
|
||
// set mock results | ||
mockResults = Object.assign({}, input) | ||
return undefined | ||
} |
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
Oops, something went wrong.