MCPcopy Create free account
hub / github.com/codemix/graph / setupQueryExecutionGraph

Function setupQueryExecutionGraph

packages/graph/src/test/queryExecution.test.ts:38–88  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

36}
37
38function setupQueryExecutionGraph(): Graph<GraphSchema> {
39 // Create a simple schema
40 const schema = {
41 vertices: {
42 User: {
43 properties: {
44 name: { type: makeType<string>("") },
45 age: { type: makeType<number>(0) },
46 active: { type: makeType<boolean>(false) },
47 },
48 },
49 },
50 edges: {
51 follows: {
52 properties: {},
53 },
54 likes: {
55 properties: {},
56 },
57 },
58 } as const satisfies GraphSchema;
59
60 const graph = new Graph({ schema, storage: new InMemoryGraphStorage() });
61
62 // Add some test data
63 const alice = graph.addVertex("User", {
64 name: "Alice",
65 age: 25,
66 active: true,
67 });
68 const bob = graph.addVertex("User", { name: "Bob", age: 30, active: true });
69 const charlie = graph.addVertex("User", {
70 name: "Charlie",
71 age: 20,
72 active: false,
73 });
74 const david = graph.addVertex("User", {
75 name: "David",
76 age: 35,
77 active: true,
78 });
79
80 // Create some relationships
81 graph.addEdge(alice.id, "follows", bob.id, {});
82 graph.addEdge(alice.id, "follows", charlie.id, {});
83 graph.addEdge(bob.id, "follows", david.id, {});
84 graph.addEdge(charlie.id, "follows", alice.id, {});
85 graph.addEdge(alice.id, "likes", bob.id, {});
86
87 return graph;
88}
89
90test("Query Execution End-to-End - Simple vertex queries - should fetch all users", () => {
91 const graph = setupQueryExecutionGraph();

Callers 1

Calls 3

addVertexMethod · 0.95
addEdgeMethod · 0.95
makeTypeFunction · 0.70

Tested by

no test coverage detected