import { describe, expect, it } from "vitest"; import { getToolcraftSelectedKeyframeTime } from "./selected-keyframe-time"; describe("getToolcraftSelectedKeyframeTime", () => { it("returns time only when the selected keyframe belongs to the exact group", () => { const groups = [ { controlId: "nested.one", keyframes: [ { controlId: "nested.one", controlLabel: "One", id: "selected", timeSeconds: 4, value: 2, valueLabel: "2", }, ], label: "One", }, ]; expect( getToolcraftSelectedKeyframeTime("nested.one", groups, "selected"), ).toBe(4); expect( getToolcraftSelectedKeyframeTime("nested.two", groups, "selected"), ).toBeUndefined(); expect( getToolcraftSelectedKeyframeTime("nested.one", groups, null), ).toBeUndefined(); }); });