import { describe, expect, it } from "vitest";
import { extractCompiledHtmlParityContract } from "./htmlParityContract";
describe("extractCompiledHtmlParityContract", () => {
it("normalizes legacy timing and nested variable JSON", () => {
const contract = extractCompiledHtmlParityContract(`
`);
expect(contract.compositions[0]).toMatchObject({
start: 1,
duration: 3,
trackIndex: 2,
variableValues: '{"a":[{"c":3,"d":4}],"z":{"a":1,"b":2}}',
});
expect(contract.timedElements[0]).toMatchObject({ start: 2, duration: 1, trackIndex: 5 });
});
it("treats embedded and project-relative resources as the same local contract", () => {
const embedded = extractCompiledHtmlParityContract(
`
`,
);
const project = extractCompiledHtmlParityContract(`
`);
expect(embedded.resources).toEqual(project.resources);
});
});