Skip to content

Commit

Permalink
chore: lint files
Browse files Browse the repository at this point in the history
  • Loading branch information
bracesproul committed Dec 2, 2024
1 parent 4b26026 commit 8cb6bd6
Showing 1 changed file with 24 additions and 14 deletions.
38 changes: 24 additions & 14 deletions libs/langgraph/src/tests/pregel.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8817,10 +8817,12 @@ export function runPregelTests(
throw new Error("Expected interrupt to return <RESUMED>");
}
return {
messages: [{
role: "user",
content: "success"
}]
messages: [
{
role: "user",
content: "success",
},
],
};
})
.addEdge(START, "one")
Expand All @@ -8836,36 +8838,44 @@ export function runPregelTests(
if (state.messages.length !== 1) {
throw new Error(`Expected 1 message, got ${state.messages.length}`);
}
return {}
return {};
})
.addEdge(START, "one")
.addEdge("one", "subgraph")
.addEdge("subgraph", "two")
.addEdge("two", END)
.compile({ checkpointer: await createCheckpointer() });

const config = { configurable: { thread_id: "test_subgraph_interrupt_resume" } };
const config = {
configurable: { thread_id: "test_subgraph_interrupt_resume" },
};

await graph.invoke({
messages: [],
}, config)
await graph.invoke(
{
messages: [],
},
config
);

const currTasks = (await graph.getState(config)).tasks;
console.log("currTasks")
console.log("currTasks");
console.log(currTasks);
expect(currTasks[0].interrupts).toHaveLength(1);

// Resume with `Command`
const result = await graph.invoke(new Command({
resume: "<RESUMED>",
}), config);
const result = await graph.invoke(
new Command({
resume: "<RESUMED>",
}),
config
);

const currTasksAfterCmd = (await graph.getState(config)).tasks;
expect(currTasksAfterCmd[0].interrupts).toHaveLength(0);

expect(result.messages).toBeDefined();
expect(result.messages).toHaveLength(1);
})
});
}

runPregelTests(() => new MemorySaverAssertImmutable());

0 comments on commit 8cb6bd6

Please sign in to comment.