Skip to content
Source
Sign inSign up
Open History to see the last commit

video.test.ts

22 lines850 Bytes

1import { describe, expect, it } from "vite-plus/test";
2​
3import { videoMimeType } from "./video.ts";
4​
5describe("videoMimeType", () => {
6 it("recognizes a saved video with a generic picker MIME type", () => {
7 expect(videoMimeType({ name: "Recording.MOV", mimeType: "application/octet-stream" })).toBe(
8 "video/quicktime",
9 );
10 });
11​
12 it("keeps an explicit video MIME type authoritative and removes parameters", () => {
13 expect(videoMimeType({ name: "recording.mp4", mimeType: " VIDEO/WebM; codecs=vp9 " })).toBe(
14 "video/webm",
15 );
16 });
17​
18 it("does not treat a TypeScript file the OS labels as MPEG transport stream as video", () => {
19 expect(videoMimeType({ name: "clamp.ts", mimeType: "video/mp2t" })).toBeNull();
20 expect(videoMimeType({ name: "clamp.ts", mimeType: "video/vnd.dlna.mpeg-tts" })).toBeNull();
21 });
22});