Skip to content
This repository was archived by the owner on Apr 15, 2025. It is now read-only.

Commit 20feea1

Browse files
committed
Updated jest test info in README to support new static methods.
1 parent 50ac125 commit 20feea1

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,9 +263,16 @@ React Native Image Cache HOC must be run in a native environment to work correct
263263
jest.mock('react-native-image-cache-hoc', () => {
264264

265265
const mockComponent = require('react-native/jest/mockComponent');
266+
const MockCacheableImage = mockComponent('Image');
267+
268+
// Add mock static methods
269+
// To see how to use jest.fn() to return mock data in your tests see the following:
270+
// https://facebook.github.io/jest/docs/en/mock-function-api.html
271+
MockCacheableImage.cacheFile = jest.fn();
272+
MockCacheableImage.flush = jest.fn();
266273

267274
return function() {
268-
return mockComponent('Image');
275+
return MockCacheableImage;
269276
}
270277

271278
});

0 commit comments

Comments
 (0)