Created
August 17, 2020 13:49
-
-
Save javierfernandes/ba81c9ef1323d30c2a1edbcb7c3f2457 to your computer and use it in GitHub Desktop.
Higher-order function to create a custom "describe" function keeping the .only/.skip functionality
This file contains hidden or 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 internalDescribe = (describeFn, bodyCaller) => (title, body) => | |
| describeFn(title, () => bodyCaller(body)) | |
| const createCustomDescribe = bodyCaller => { | |
| const customDescribe = internalDescribe(describe, bodyCaller) | |
| customDescribe.only = internalDescribe(describe.only, bodyCaller) | |
| customDescribe.skip = internalDescribe(describe.skip, bodyCaller) | |
| return customDescribe | |
| } | |
| export default createCustomDescribe |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment