| 1 | 'use strict'; |
| 2 | |
| 3 | const { parseRenderOptions } = require('../server/image-subtitles'); |
| 4 | |
| 5 | describe('image subtitle option parsing', () => |
| 6 | { |
| 7 | test('accepts streamIndex 0 as a valid value', () => |
| 8 | { |
| 9 | const parsed = parseRenderOptions({ |
| 10 | filePath: '/tmp/example.mkv', |
| 11 | streamIndex: 0, |
| 12 | timeSeconds: 24.5, |
| 13 | canvasWidth: 1920, |
| 14 | canvasHeight: 1080, |
| 15 | }); |
| 16 | |
| 17 | expect(parsed.streamIndex).toBe(0); |
| 18 | expect(parsed.timeSeconds).toBeCloseTo(24.5, 3); |
| 19 | expect(parsed.isValid).toBe(true); |
| 20 | }); |
| 21 | |
| 22 | test('rejects non-numeric streamIndex values', () => |
| 23 | { |
| 24 | const parsed = parseRenderOptions({ |
| 25 | filePath: '/tmp/example.mkv', |
| 26 | streamIndex: '', |
| 27 | timeSeconds: 24.5, |
| 28 | }); |
| 29 | |
| 30 | expect(parsed.isValid).toBe(false); |
| 31 | }); |
| 32 | }); |