import { describe, expect, it, vi } from 'vitest' import { isIosDevice } from './cameraSession' describe('camera session platform detection', () => { it('detects iPhone and iPad user agents', () => { expect(isIosDevice('Mozilla/5.0 (iPhone; CPU iPhone OS 26_0 like Mac OS X)', 'iPhone', 5)).toBe(true) expect(isIosDevice('Mozilla/5.0 (iPad; CPU OS 18_0 like Mac OS X)', 'iPad', 5)).toBe(true) }) it('detects iPadOS desktop user agent mode', () => { expect(isIosDevice('Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15)', 'MacIntel', 5)).toBe(true) }) it('does not treat Android Chrome as iOS', () => { expect(isIosDevice('Mozilla/5.0 (Linux; Android 16; Pixel 9) Chrome/140', 'Linux armv8l', 5)).toBe(false) }) it('does not depend on mocked browser globals when explicit values are supplied', () => { vi.stubGlobal('navigator', { userAgent: 'ignored', platform: 'ignored', maxTouchPoints: 0 }) expect(isIosDevice('Android', 'Linux', 1)).toBe(false) vi.unstubAllGlobals() }) })