


























@@ -3,9 +3,6 @@ import {
33isSessionTranscriptLeafControl,
44mergeSessionTranscriptVisiblePathWithOpaqueAppendPath,
55parseSessionTranscriptTreeEntry,
6-readSessionTranscriptLeafUpdate,
7-resolveSessionTranscriptAppendParentId,
8-resolveSessionTranscriptLeafId,
96scanSessionTranscriptTree,
107selectSessionTranscriptLeafControlledPath,
118selectSessionTranscriptTreePathNodes,
@@ -44,7 +41,6 @@ describe("session transcript tree helpers", () => {
4441leafId: "active-tail",
4542appendParentId: "active-tail",
4643});
47-expect(readSessionTranscriptLeafUpdate(leaf)).toBe("active-tail");
4844});
49455046it("resolves a distinct opaque append parent from a leaf control", () => {
@@ -60,8 +56,10 @@ describe("session transcript tree helpers", () => {
6056},
6157];
625863-expect(resolveSessionTranscriptLeafId(entries)).toBe("active-tail");
64-expect(resolveSessionTranscriptAppendParentId(entries)).toBe("plugin-metadata");
59+expect(scanSessionTranscriptTree(entries)).toMatchObject({
60+leafId: "active-tail",
61+appendParentId: "plugin-metadata",
62+});
6563expect(selectSessionTranscriptLeafControlledPath(entries)).toEqual(entries.slice(0, 1));
6664});
6765@@ -77,14 +75,16 @@ describe("session transcript tree helpers", () => {
7775const metadata = { type: "metadata", id: "plugin-metadata", parentId: "side-entry" };
7876const entries = [activeRoot, sideEntry, leafControl, metadata];
797780-expect(resolveSessionTranscriptLeafId(entries)).toBe("active-root");
81-expect(resolveSessionTranscriptAppendParentId(entries)).toBe("plugin-metadata");
78+expect(scanSessionTranscriptTree(entries)).toMatchObject({
79+leafId: "active-root",
80+appendParentId: "plugin-metadata",
81+});
8282expect(selectSessionTranscriptLeafControlledPath(entries)).toEqual([activeRoot]);
8383});
84848585it("resolves the last valid leaf update in file order", () => {
8686expect(
87-resolveSessionTranscriptLeafId([
87+scanSessionTranscriptTree([
8888{ type: "message", id: "active-tail", parentId: null },
8989{ type: "message", id: "inactive-tail", parentId: "active-tail" },
9090{
@@ -93,7 +93,7 @@ describe("session transcript tree helpers", () => {
9393parentId: "inactive-tail",
9494targetId: "active-tail",
9595},
96-]),
96+]).leafId,
9797).toBe("active-tail");
9898});
9999@@ -109,8 +109,10 @@ describe("session transcript tree helpers", () => {
109109},
110110];
111111112-expect(resolveSessionTranscriptLeafId(entries)).toBeNull();
113-expect(resolveSessionTranscriptAppendParentId(entries)).toBe("old-tail");
112+expect(scanSessionTranscriptTree(entries)).toMatchObject({
113+leafId: null,
114+appendParentId: "old-tail",
115+});
114116expect(selectSessionTranscriptLeafControlledPath(entries)).toEqual([]);
115117});
116118此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。