Last active
August 29, 2015 14:01
-
-
Save jeffmo/e154a997c5fb74780576 to your computer and use it in GitHub Desktop.
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
| // __tests__/Foo-test.js | |
| describe('hai', function() { | |
| it('asdf', function() { | |
| var mockedImplWithReturn = jest.genMockFn().mockImpl(function() { | |
| console.log(' running impl'); | |
| return 'impl value'; | |
| }).mockReturnValue('mock return value'); | |
| var mockedImplWithoutReturn = jest.genMockFn().mockImpl(function() { | |
| console.log(' running impl'); | |
| return 'impl value'; | |
| }); | |
| var ret; | |
| console.log('Running mockedImplWithReturn:'); | |
| ret = mockedImplWithReturn(); | |
| console.log(' Returned:', ret); | |
| console.log('Running mockedImplWithoutReturn:'); | |
| ret = mockedImplWithoutReturn(); | |
| console.log(' Returned:', ret); | |
| }); | |
| }); |
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
| Found 1 matching tests... | |
| PASS __tests__/foo-test.js (0.011s) | |
| Running mockedImplWithReturn: | |
| Returned: mock return value | |
| Running mockedImplWithoutReturn: | |
| running impl | |
| Returned: impl value | |
| 1 tests passed (1 total) | |
| Run time: 1.075s |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment