diff --git a/langgraph/src/tests/pregel.test.ts b/langgraph/src/tests/pregel.test.ts index 228980be7..95a07e799 100644 --- a/langgraph/src/tests/pregel.test.ts +++ b/langgraph/src/tests/pregel.test.ts @@ -20,7 +20,7 @@ import { } from "@langchain/core/messages"; import { ToolCall } from "@langchain/core/messages/tool"; import { - fromAsync, + gatherIterator, FakeChatModel, MemorySaverAssertImmutable, } from "./utils.js"; @@ -2326,7 +2326,9 @@ describe("StateGraph", () => { const graph = builder.compile(); expect( - await fromAsync(graph.stream({ value: 1 }, { streamMode: ["values"] })) + await gatherIterator( + graph.stream({ value: 1 }, { streamMode: ["values"] }) + ) ).toEqual([ { value: 1 }, { value: 2 }, @@ -2337,7 +2339,9 @@ describe("StateGraph", () => { ]); expect( - await fromAsync(graph.stream({ value: 1 }, { streamMode: ["updates"] })) + await gatherIterator( + graph.stream({ value: 1 }, { streamMode: ["updates"] }) + ) ).toEqual([ { add_one: { value: 1 } }, { add_one: { value: 1 } }, @@ -2347,7 +2351,7 @@ describe("StateGraph", () => { ]); expect( - await fromAsync( + await gatherIterator( graph.stream({ value: 1 }, { streamMode: ["values", "updates"] }) ) ).toEqual([ diff --git a/langgraph/src/tests/utils.ts b/langgraph/src/tests/utils.ts index 2aa47693f..fa2724cd1 100644 --- a/langgraph/src/tests/utils.ts +++ b/langgraph/src/tests/utils.ts @@ -183,7 +183,8 @@ export class FakeSearchTool extends Tool { } } -export async function fromAsync( +// https://github.com/tc39/proposal-array-from-async +export async function gatherIterator( i: AsyncIterable | Promise> ): Promise> { const out: T[] = [];