Files
iNaturalistReactNative/__mocks__/@dr.pogodin/react-native-fs.ts
Johannes Klein 3036529323 Switch react-native-fs (#3524)
* Update package.json

* Update package-lock.json

* Update Podfile.lock

* Update PrivacyInfo.xcprivacy

* Update react-native-logs.config.ts

* Update paths.ts

* Update savePhotoToDocumentsDirectory.ts

* Update useAppSize.ts

* Update installData.ts

* Update mlModel.ts

* Update storageMetrics.ts

* Update removeAllFilesFromDirectory.ts

* Update util.ts

* Update removeSyncedFilesFromDirectory.ts

* Update contexts.ts

* Update index.ts

* Update Photo.ts

* Update Sound.js

* Update logManagementHelpers.ts

* Update PhotoLibrary.tsx

* Update flattenUploadParams.ts

* Update shouldFetchObservationLocation.ts

* Update Developer.tsx

* Update vision-camera.js

* Update sentinelFiles.ts

* Move mock

* Switch to unlink util
2026-04-14 00:57:20 +02:00

34 lines
1000 B
TypeScript

const mockFs = require( "fs" );
module.exports = {
appendFile: jest.fn( ),
CachesDirectoryPath: "caches/directory/path",
DocumentDirectoryPath: "document/directory/path",
exists: jest.fn( async name => !name.includes( "sentinelFiles" ) ),
moveFile: async ( ) => "testdata",
copyFile: async ( ) => "testdata",
copyAssetsFileIOS: 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( ) );
} ),
};