mirror of
https://github.com/inaturalist/iNaturalistReactNative.git
synced 2026-05-18 21:35:46 -04:00
* Get a few mocks working in __mocks__ folder * Move more mocks into __mocks__ * Move mocks * Move zustand mock * Add more mocks to __mocks__ * More mocks * Move more files to __mocks__ and audit existing mocks * Mock react navigation in __mocks__ * Restore test to help with imports after jest env torn down * Add fake timer to integration test with userEvent * Add RN paper mock
33 lines
920 B
TypeScript
33 lines
920 B
TypeScript
const mockFs = require( "fs" );
|
|
|
|
module.exports = {
|
|
appendFile: jest.fn( ),
|
|
CachesDirectoryPath: "caches/directory/path",
|
|
DocumentDirectoryPath: "document/directory/path",
|
|
exists: jest.fn( async ( ) => true ),
|
|
moveFile: async ( ) => "testdata",
|
|
copyFile: async ( ) => "testdata",
|
|
stat: jest.fn( ( ) => ( {
|
|
mtime: new Date()
|
|
} ) ),
|
|
readFile: jest.fn( ( ) => "testdata" ),
|
|
readDir: jest.fn( async ( ) => ( [
|
|
{
|
|
ctime: new Date(),
|
|
mtime: new Date(),
|
|
name: "testdata"
|
|
}
|
|
] ) ),
|
|
writeFile: jest.fn( async ( filePath, contents, _encoding ) => {
|
|
mockFs.writeFile( filePath, contents, jest.fn( ) );
|
|
} ),
|
|
mkdir: jest.fn( async ( filepath, _options ) => {
|
|
mockFs.mkdir( filepath, jest.fn( ) );
|
|
} ),
|
|
unlink: jest.fn( async ( path = "" ) => {
|
|
if ( !path ) return;
|
|
if ( typeof ( path ) !== "string" ) return;
|
|
mockFs.unlink( path, jest.fn( ) );
|
|
} )
|
|
};
|