mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-11 14:50:02 +00:00
refactor(core): extract maxEndTime+serialize to parsers/test-utils.ts (TU) (#1261)
* test(studio): add T5b rotation+motion build-patches characterization Extends manualEditsDomPatches.test.ts with rotation and motion pairs. Same 4-pattern structure: populated, empty, clear restores originals, build/clear symmetry. Merges duplicate manualEditsTypes import block. * test(studio): add T5c review-fix gaps in manualEditsDomPatches characterization Fixes four gaps identified in max-setting code review: - Box-size clear: replace arrayContaining with full ordered toEqual (30 ops) - Box-size / pathOffset / rotation clear: add empty-string coercion tests (origVal||null must produce null, not set property to "") - Rotation clear: add test for absent STUDIO_ORIGINAL_ROTATION_TRANSFORM_ORIGIN_ATTR - Motion clear: prove input-independence by calling with both empty and populated element and asserting identical output * refactor(core): extract maxEndTime+serialize to parsers/test-utils.ts (TU) Deduplicate helpers shared by T1 (htmlParser.roundtrip.test.ts) and T2 (stableIds.test.ts). Both files inline identical implementations; extract to test-utils.ts so future parser tests (T6a…) import one copy. Also fix lefthook fallow command to unset GIT_DIR+GIT_INDEX_FILE before running — those vars are set by git in worktree hook context and block fallow’s internal temp-worktree creation.
This commit is contained in:
@@ -13,23 +13,7 @@
|
||||
*/
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { parseHtml } from "./htmlParser.js";
|
||||
import { generateHyperframesHtml } from "../generators/hyperframes.js";
|
||||
import type { ParsedHtml } from "./htmlParser.js";
|
||||
|
||||
function maxEndTime(elements: ParsedHtml["elements"]): number {
|
||||
if (elements.length === 0) return 0;
|
||||
return Math.max(...elements.map((e) => e.startTime + e.duration));
|
||||
}
|
||||
|
||||
function serialize(parsed: ParsedHtml): string {
|
||||
return generateHyperframesHtml(parsed.elements, maxEndTime(parsed.elements), {
|
||||
compositionId: "test-comp",
|
||||
resolution: parsed.resolution,
|
||||
styles: parsed.styles ?? undefined,
|
||||
keyframes: parsed.keyframes,
|
||||
stageZoomKeyframes: parsed.stageZoomKeyframes,
|
||||
});
|
||||
}
|
||||
import { serialize } from "./test-utils.js";
|
||||
|
||||
describe("T2 — stable element ids (spec for R1)", () => {
|
||||
// --- Spec (red until R1) ---
|
||||
|
||||
Reference in New Issue
Block a user