Skip to content

Commit

Permalink
Rename
Browse files Browse the repository at this point in the history
  • Loading branch information
dqbd committed Aug 14, 2024
1 parent 21a1430 commit ff8afe8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
12 changes: 8 additions & 4 deletions langgraph/src/tests/pregel.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
} from "@langchain/core/messages";
import { ToolCall } from "@langchain/core/messages/tool";
import {
fromAsync,
gatherIterator,
FakeChatModel,
MemorySaverAssertImmutable,
} from "./utils.js";
Expand Down Expand Up @@ -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 },
Expand All @@ -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 } },
Expand All @@ -2347,7 +2351,7 @@ describe("StateGraph", () => {
]);

expect(
await fromAsync(
await gatherIterator(
graph.stream({ value: 1 }, { streamMode: ["values", "updates"] })
)
).toEqual([
Expand Down
3 changes: 2 additions & 1 deletion langgraph/src/tests/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,8 @@ export class FakeSearchTool extends Tool {
}
}

export async function fromAsync<T>(
// https://github.com/tc39/proposal-array-from-async
export async function gatherIterator<T>(
i: AsyncIterable<T> | Promise<AsyncIterable<T>>
): Promise<Array<T>> {
const out: T[] = [];
Expand Down

0 comments on commit ff8afe8

Please sign in to comment.