|
1 | 1 | import { describe, expect, it } from "vitest" |
2 | 2 |
|
3 | | -import { resolveRuntimeVersion } from "../app.config.base" |
| 3 | +import createExpoConfig, { resolveRuntimeVersion } from "../app.config.base" |
4 | 4 |
|
5 | 5 | describe("resolveRuntimeVersion", () => { |
6 | 6 | it("keeps the development runtime version stable", () => { |
@@ -33,3 +33,42 @@ describe("resolveRuntimeVersion", () => { |
33 | 33 | ).toThrow(/OTA_RUNTIME_VERSION/i) |
34 | 34 | }) |
35 | 35 | }) |
| 36 | + |
| 37 | +describe("Android media permissions", () => { |
| 38 | + const config = createExpoConfig({ |
| 39 | + config: {}, |
| 40 | + } as Parameters<typeof createExpoConfig>[0]) |
| 41 | + |
| 42 | + it("blocks broad media access that is not required by the app", () => { |
| 43 | + expect(config.android?.blockedPermissions).toEqual([ |
| 44 | + "android.permission.ACCESS_MEDIA_LOCATION", |
| 45 | + "android.permission.CAMERA", |
| 46 | + "android.permission.READ_EXTERNAL_STORAGE", |
| 47 | + "android.permission.READ_MEDIA_AUDIO", |
| 48 | + "android.permission.READ_MEDIA_IMAGES", |
| 49 | + "android.permission.READ_MEDIA_VIDEO", |
| 50 | + "android.permission.READ_MEDIA_VISUAL_USER_SELECTED", |
| 51 | + "android.permission.RECORD_AUDIO", |
| 52 | + ]) |
| 53 | + }) |
| 54 | + |
| 55 | + it("configures media APIs for picker and write-only access", () => { |
| 56 | + expect(config.plugins).toContainEqual([ |
| 57 | + "expo-media-library", |
| 58 | + { |
| 59 | + photosPermission: "Allow $(PRODUCT_NAME) to access your photos.", |
| 60 | + savePhotosPermission: "Allow $(PRODUCT_NAME) to save photos.", |
| 61 | + isAccessMediaLocationEnabled: false, |
| 62 | + granularPermissions: [], |
| 63 | + }, |
| 64 | + ]) |
| 65 | + expect(config.plugins).toContainEqual([ |
| 66 | + "expo-image-picker", |
| 67 | + { |
| 68 | + photosPermission: "Allow $(PRODUCT_NAME) to access your photos.", |
| 69 | + cameraPermission: false, |
| 70 | + microphonePermission: false, |
| 71 | + }, |
| 72 | + ]) |
| 73 | + }) |
| 74 | +}) |
0 commit comments