锁定移动相册权限拒绝边界
移动文件单测覆盖相册权限拒绝不启动 picker 移动壳配置检查反查相册权限拒绝测试
This commit is contained in:
@@ -2078,6 +2078,9 @@ for (const snippet of [
|
||||
'exportAudioFile({',
|
||||
"code: 'unsupported_capability'",
|
||||
"code: 'cancelled'",
|
||||
'rejects image import before picker launch when library permission is denied',
|
||||
"message: 'photo library permission denied'",
|
||||
'expect(imageLibraryMock).not.toHaveBeenCalled()',
|
||||
"message: 'camera permission denied'",
|
||||
"mediaTypes: ['images']",
|
||||
"options: { encoding: 'base64' }",
|
||||
|
||||
@@ -288,6 +288,21 @@ describe('mobile HostBridge file actions', () => {
|
||||
expect(cameraMock).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
test('rejects image import before picker launch when library permission is denied', async () => {
|
||||
libraryPermissionMock.mockResolvedValueOnce({
|
||||
status: ImagePicker.PermissionStatus.DENIED,
|
||||
granted: false,
|
||||
canAskAgain: false,
|
||||
expires: 'never',
|
||||
});
|
||||
|
||||
await expect(importImageFile()).rejects.toMatchObject({
|
||||
code: 'host_error',
|
||||
message: 'photo library permission denied',
|
||||
});
|
||||
expect(imageLibraryMock).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
test('imports audio and exports binary files through controlled payloads', async () => {
|
||||
fileBase64Data.set('file:///picked/voice.mp3', MP3_BASE64);
|
||||
fileSizes.set('file:///picked/voice.mp3', Buffer.byteLength('ID3\x04\x00\x00\x00\x00\x00\x10'));
|
||||
|
||||
Reference in New Issue
Block a user