Files
iNaturalistReactNative/__mocks__/@react-native-camera-roll/camera-roll.ts
Johannes Klein 5c8e3be12c test AI camera in e2e (#2188)
* Add a cameraZoomRange default
* Small detox version bump
* Add a mocked camera with a take photo button
* An e2e mock for the computer vision plugin predicting a frame
* Mock taking a photo by loading the first photo from the CameraRoll

Closes #1981
2024-11-01 10:38:37 -07:00

36 lines
975 B
TypeScript

import mockFaker from "tests/helpers/faker";
export const nativeInterface = jest.fn( );
export const CameraRoll = {
getPhotos: jest.fn( ( ) => new Promise( resolve => {
resolve( {
page_info: {
end_cursor: jest.fn( ),
has_next_page: false
},
edges: [
{
node: {
image: {
filename: "IMG_20210901_123456.jpg",
filepath: "/path/to/IMG_20210901_123456.jpg",
extension: "jpg",
uri: "file:///path/to/IMG_20210901_123456.jpg",
height: 1920,
width: 1080,
fileSize: 123456,
playableDuration: NaN,
orientation: 1
}
}
}
]
} );
} ) ),
getAlbums: jest.fn( ( ) => ( {
// Expecting album titles as keys and photo counts as values
// "My Amazing album": 12
} ) ),
save: jest.fn( ( _uri, _options = {} ) => mockFaker.system.filePath( ) )
};