Skip to content

Instantly share code, notes, and snippets.

@savelichalex
Created July 19, 2017 10:11
Show Gist options
  • Save savelichalex/899b3da53c8ef2de2eb664829b97cf7d to your computer and use it in GitHub Desktop.
Save savelichalex/899b3da53c8ef2de2eb664829b97cf7d to your computer and use it in GitHub Desktop.
// some-js-file.js
export const myFunctionToTestWithRNFS = (fs) => {
fs.readDir(...);
};
// some-file-when-use-rnfs.js
import RNFS from 'react-native-fs';
import { myFunctionToTestWithRNFS } from './some-js-file.js';
myFunctionToTestWithRNFS(RNFS);
// tests
import { myFunctionToTestWithRNFS } from './some-js-file.js';
describe('My tests', () => {
it('should test my function with fs mock', () => {
myFunctionToTestWithRNFS({
readDir: () => {},
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment