Files
TREK/client/tests/unit/utils/videoPoster.test.ts
T
Maurice c92c02e1b8 feat(video): play local gallery videos in the journey gallery
Picking a video in the journey gallery now captures a poster frame + duration in the browser and uploads the raw clip; the grid shows the poster with a play badge and the lightbox plays it with a native video player (HTTP Range seeking). Images keep their existing HEIC-normalised path. No server-side transcoding.

Server media_type work was committed separately.
2026-06-30 12:27:28 +02:00

21 lines
910 B
TypeScript

/**
* videoPoster unit tests (#823). The poster-capture path needs a real <video>
* decoder + canvas, which jsdom does not provide, so we cover the pure file-type
* gate here; poster capture is exercised manually / in the browser.
*/
import { describe, it, expect } from 'vitest'
import { isVideoFile } from '../../../src/utils/videoPoster'
describe('isVideoFile', () => {
it('is true for a video MIME type', () => {
expect(isVideoFile(new File([], 'clip.mp4', { type: 'video/mp4' }))).toBe(true)
expect(isVideoFile(new File([], 'clip.webm', { type: 'video/webm' }))).toBe(true)
})
it('is false for images and other files', () => {
expect(isVideoFile(new File([], 'photo.jpg', { type: 'image/jpeg' }))).toBe(false)
expect(isVideoFile(new File([], 'doc.pdf', { type: 'application/pdf' }))).toBe(false)
expect(isVideoFile(new File([], 'noext', { type: '' }))).toBe(false)
})
})