| 1 | import { describe, expect, it } from 'vitest' |
| 2 | import { isPdfExportSupported } from './printSupport' |
| 3 | |
| 4 | describe('isPdfExportSupported', () => { |
| 5 | it.each([ |
| 6 | ['Safari on macOS', 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.2 Safari/605.1.15'], |
| 7 | ['Safari on iOS', 'Mozilla/5.0 (iPhone; CPU iPhone OS 18_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.2 Mobile/15E148 Safari/604.1'], |
| 8 | ['Chrome on iOS', 'Mozilla/5.0 (iPhone; CPU iPhone OS 18_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/131.0.6778.73 Mobile/15E148 Safari/604.1'], |
| 9 | ['Firefox on iOS', 'Mozilla/5.0 (iPhone; CPU iPhone OS 18_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) FxiOS/133.0 Mobile/15E148 Safari/605.1.15'], |
| 10 | ])('is false in WebKit: %s', (_, userAgent) => { |
| 11 | expect(isPdfExportSupported(userAgent)).toBe(false) |
| 12 | }) |
| 13 | |
| 14 | it.each([ |
| 15 | ['Chrome on macOS', 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36'], |
| 16 | ['Edge on Windows', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36 Edg/131.0.0.0'], |
| 17 | ['Chromium on Linux', 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chromium/131.0.0.0 Safari/537.36'], |
| 18 | ['Firefox on Windows', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:133.0) Gecko/20100101 Firefox/133.0'], |
| 19 | ])('is true elsewhere: %s', (_, userAgent) => { |
| 20 | expect(isPdfExportSupported(userAgent)).toBe(true) |
| 21 | }) |
| 22 | }) |
| 23 |