Fixed ImageLoader Mock for Android
Summary: When trying to mock an Image on Android, this error occurs referencing the ImageLoader mock in setup.js: ``` /Users/.../node_modules/react-native/jest/setup.js:120 return success(320,240); ^ TypeError: success is not a function at /Users/.../node_modules/react-native/jest/setup.js:120:8 at _combinedTickCallback (internal/process/next_tick.js:73:7) at process._tickCallback (internal/process/next_tick.js:104:9) ``` - Mocking Images works for iOS but not Android. - Since Image.android.js uses ImageLoader vs ImageViewManager, the code cannot be carried over from iOS. Since this is code within the testing framework, the existing tests should test this. If there is no existing test coverage, then this would need to be done. Closes https://github.com/facebook/react-native/pull/14262 Differential Revision: D5162640 Pulled By: shergin fbshipit-source-id: 5b1efbbb685b767e09b5c7fb05f073445c94a3aa
This commit is contained in:
parent
8394f9b553
commit
7c2ef3281f
|
@ -124,7 +124,7 @@ const mockNativeModules = {
|
|||
},
|
||||
ImageLoader: {
|
||||
getSize: jest.fn(
|
||||
(uri, success) => process.nextTick(() => success(320, 240))
|
||||
(url) => new Promise(() => ({width: 320, height: 240}))
|
||||
),
|
||||
prefetchImage: jest.fn(),
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue