Migrate Expo image manipulator API (#11661)

This commit is contained in:
Samuel Newman
2026-09-04 16:59:55 +03:00
committed by GitHub
parent 48f96d6421
commit a197340bce
7 changed files with 285 additions and 122 deletions
+30 -9
View File
@@ -36,15 +36,36 @@ jest.mock('expo-file-system/legacy', () => ({
createDownloadResumable: jest.fn(),
}))
jest.mock('expo-image-manipulator', () => ({
manipulateAsync: jest.fn().mockResolvedValue({
uri: 'file://resized-image',
}),
SaveFormat: {
JPEG: 'jpeg',
WEBP: 'webp',
},
}))
jest.mock('expo-image-manipulator', () => {
const createContext = () => {
const image = {
height: 100,
release: jest.fn(),
saveAsync: jest.fn().mockResolvedValue({
height: 100,
uri: 'file://resized-image',
width: 100,
}),
width: 100,
}
return {
crop: jest.fn(),
release: jest.fn(),
renderAsync: jest.fn().mockResolvedValue(image),
resize: jest.fn(),
}
}
return {
ImageManipulator: {
manipulate: jest.fn(createContext),
},
SaveFormat: {
JPEG: 'jpeg',
WEBP: 'webp',
},
}
})
jest.mock('expo-camera', () => ({
Camera: {