Files
Toju/toju-app/src/app/infrastructure/mobile/logic/mobile-runtime-permissions.rules.spec.ts
Myx bdea95511d fix: Bug - Android app doesn't ask for permissions
Prompt for microphone, camera, and notification runtime permissions during Capacitor startup, and fall back to WebView getUserMedia when the native preflight bridge fails so voice joins still surface Android permission dialogs.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-11 21:06:51 +02:00

42 lines
1.3 KiB
TypeScript

import {
describe,
expect,
it
} from 'vitest';
import {
areMobileRuntimePermissionsGranted,
shouldPromptForNotificationPermission,
shouldRequestMobileRuntimePermissions
} from './mobile-runtime-permissions.rules';
describe('mobile-runtime-permissions.rules', () => {
it('only requests runtime permissions on Capacitor shells', () => {
expect(shouldRequestMobileRuntimePermissions('capacitor')).toBe(true);
expect(shouldRequestMobileRuntimePermissions('browser')).toBe(false);
expect(shouldRequestMobileRuntimePermissions('electron')).toBe(false);
});
it('prompts for notification permissions until granted', () => {
expect(shouldPromptForNotificationPermission('granted')).toBe(false);
expect(shouldPromptForNotificationPermission('prompt')).toBe(true);
expect(shouldPromptForNotificationPermission('denied')).toBe(true);
});
it('requires every runtime permission alias to be granted', () => {
expect(areMobileRuntimePermissionsGranted({
voiceGranted: true,
cameraGranted: true,
localNotificationsGranted: true,
pushNotificationsGranted: true
})).toBe(true);
expect(areMobileRuntimePermissionsGranted({
voiceGranted: false,
cameraGranted: true,
localNotificationsGranted: true,
pushNotificationsGranted: true
})).toBe(false);
});
});