feat: Add slashcommand api
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
import {
|
||||
describe,
|
||||
expect,
|
||||
it
|
||||
} from 'vitest';
|
||||
|
||||
import {
|
||||
isCameraCaptureAllowed,
|
||||
isMobileCapturePermissionGranted,
|
||||
isVoiceCaptureAllowed,
|
||||
shouldPreflightMobileCapturePermissions
|
||||
} from './mobile-media-permission.rules';
|
||||
|
||||
describe('mobile-media-permission.rules', () => {
|
||||
it('only preflights capture permissions on Capacitor shells', () => {
|
||||
expect(shouldPreflightMobileCapturePermissions('capacitor')).toBe(true);
|
||||
expect(shouldPreflightMobileCapturePermissions('browser')).toBe(false);
|
||||
expect(shouldPreflightMobileCapturePermissions('electron')).toBe(false);
|
||||
});
|
||||
|
||||
it('treats granted as the only successful native permission state', () => {
|
||||
expect(isMobileCapturePermissionGranted('granted')).toBe(true);
|
||||
expect(isMobileCapturePermissionGranted('prompt')).toBe(false);
|
||||
expect(isMobileCapturePermissionGranted('denied')).toBe(false);
|
||||
});
|
||||
|
||||
it('requires microphone permission for voice capture', () => {
|
||||
expect(isVoiceCaptureAllowed({ microphone: 'granted' })).toBe(true);
|
||||
expect(isVoiceCaptureAllowed({ microphone: 'denied' })).toBe(false);
|
||||
});
|
||||
|
||||
it('requires camera permission for camera capture', () => {
|
||||
expect(isCameraCaptureAllowed({ camera: 'granted' })).toBe(true);
|
||||
expect(isCameraCaptureAllowed({ camera: 'prompt' })).toBe(false);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user