Skip to content

armgit / hypit

Public Imported from GitHub
0

Clone any viral video with AI agents. Not just a script, the whole workflow: swap the face, the words, the B-roll, ship 100 variants in one command, and get your 100M views.

1.3 KB
Raw Blame
import assert from "node:assert/strict";
import test from "node:test";

import { sealTimeline } from "@hypit/timeline";

import { resolveRegionEvidence } from "../src/index.js";

test("Region Evidence resolves normalized evidence inside any explicit program Frame", () => {
  const timeline = sealTimeline({ id: "program", frameCount: 3, frameRate: { numerator: 30, denominator: 1 } });
  const evidence = resolveRegionEvidence({
    path: "/project/tracking.svs#heads.default",
    properties: {
      series: [{ id: "GUEST", regions: [[0.5, 0.1, 0.2, 0.3], null, [0.52, 0.11, 0.2, 0.3]] }],
    },
  }, { xPx: 100, yPx: 200, widthPx: 400, heightPx: 800 }, timeline);

  assert.deepEqual(evidence.series[0]?.frames[0], { xPx: 300, yPx: 280, widthPx: 80, heightPx: 240 });
  assert.equal(evidence.series[0]?.frames[1], null);
  assert.equal(evidence.timelineId, timeline.id);
});

test("Region Evidence rejects implicit gaps and geometry outside its declared Frame", () => {
  const timeline = sealTimeline({ id: "program", frameCount: 1, frameRate: { numerator: 30, denominator: 1 } });
  assert.throws(() => resolveRegionEvidence({
    path: "/project/tracking.svs#heads.default",
    properties: { series: [{ id: "GUEST", regions: [[0.9, 0.1, 0.2, 0.3]] }] },
  }, { xPx: 0, yPx: 0, widthPx: 100, heightPx: 100 }, timeline), /inside its Frame/u);
});