Last active
May 23, 2017 18:05
-
-
Save alenia/e1128775487e8a3fafd134496ba01c89 to your computer and use it in GitHub Desktop.
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 mockRootNavigator1 = function() { | |
return { | |
router: { | |
getComponentForState: jest.fn | |
} | |
} | |
} | |
function mockRootNavigator2() { | |
return { | |
router: { | |
getComponentForState: jest.fn | |
} | |
} | |
} | |
const mockRootNavigator3 = () => { | |
return { | |
router: { | |
getComponentForState: jest.fn | |
} | |
} | |
} | |
//jest.mock('../../navigators/root_navigator', () => { //if I uncomment this it'll work | |
//return { | |
//router: { | |
//getComponentForState: jest.fn | |
//} | |
//} | |
//}) | |
jest.mock('../../navigators/root_navigator', mockRootNavigator1) // this will fail | |
//jest.mock('../../navigators/root_navigator', mockRootNavigator2) // this will fail | |
//jest.mock('../../navigators/root_navigator', mockRootNavigator3) // this will fail |
As far as I can tell the only difference is a named function vs an anonymous function
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If I use lines 8-14 instead of line 15 it works