Fix FastImage preload error
With [react-native-fast-image](https://github.com/DylanVann/react-native-fast-image)
, you can preload images like this:
import FastImage from 'react-native-fast-image';
FastImage.preload([
{
uri: 'https://facebook.github.io/react/img/logo_og.png',
headers: {Authorization: 'someAuthToken'},
},
]);
But after integrated, yarn test
yelled at me:
TypeError: Cannot read property 'preload' of undefined
A quick Google search didn't give me anything useful, but I noticed it's similar to another issue I came across before:
// Fix: "TypeError: Cannot read property 'DocumentDir' of undefined"
// https://github.com/wkh237/react-native-fetch-blob/issues/212#issuecomment-308182094
jest.mock('rn-fetch-blob', () => {
return {
DocumentDir: () => {},
polyfill: () => {},
};
});
So I tried this, it works.
// Fix: "TypeError: Cannot read property 'preload' of undefined"
jest.mock('react-native-fast-image', () => {
return {
preload: () => {},
};
});