import { expect, test } from "vitest"; import { extractHistoryTree } from "./utils"; const data = [ { type: "ai_edit" as const, code: "3. edit with better icons and red text", inputs: { prompt: "make text red", }, }, { type: "ai_edit" as const, code: "2. edit with better icons", inputs: { prompt: "use better icons", }, }, { type: "ai_create" as const, code: "1. create", inputs: { image_url: "", }, }, ]; test("should only include history from this point onward", () => { expect(extractHistoryTree(data, 0)).toEqual([ "1. create", "use better icons", "2. edit with better icons", "make text red", "3. edit with better icons and red text", ]); expect(extractHistoryTree(data, 2)).toEqual(["1. create"]); });