Files
hyperframes/packages/engine/src/services/inPageEncodeEligibility.test.ts
T
Miguel Ángel 0bcd816d5b feat(engine): a chunk-fed encoder and the rule for which films may use it, off by default (#7029)
* feat(engine): a chunk-fed encoder and the rule for which films may use it, off by default

* test(engine): end the chunk encoder's ffprobe call with --
2026-11-02 17:53:57 +00:00

37 lines
1.2 KiB
TypeScript

import { describe, expect, it } from "vitest";
import { resolveInPageEncode, type InPageEncodeInput } from "./inPageEncodeEligibility.js";
const ready: InPageEncodeInput = {
enabled: true,
captureMode: "drawelement",
format: "mp4",
codec: "h264",
hdr: false,
transparent: false,
workers: 1,
hls: false,
videoLayer: false,
encoderSupported: true,
};
describe("resolveInPageEncode", () => {
it("takes a plain h264 mp4 drawElement film", () => {
expect(resolveInPageEncode(ready)).toEqual({ eligible: true });
});
it.each([
[{ enabled: false }, "disabled"],
[{ captureMode: "screenshot" as const }, "capture is not drawElement"],
[{ format: "webm" }, "output is not mp4"],
[{ codec: "h265" }, "codec is not h264"],
[{ hdr: true }, "hdr"],
[{ transparent: true }, "transparent"],
[{ workers: 3 }, "parallel workers"],
[{ hls: true }, "hls"],
[{ videoLayer: true }, "video layer passthrough"],
[{ encoderSupported: false }, "page encoder unsupported"],
])("leaves %j to today's path: %s", (change, reason) => {
expect(resolveInPageEncode({ ...ready, ...change })).toEqual({ eligible: false, reason });
});
});