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

Function createGraph

packages/graph/src/test/stringPredicateTraversals.test.ts:54–105  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

52} as const satisfies GraphSchema;
53
54function createGraph(): {
55 graph: Graph<GraphSchema>;
56 g: GraphTraversal<GraphSchema>;
57} {
58 const graph = new Graph({ schema, storage: new InMemoryGraphStorage() });
59 const g = new GraphTraversal(graph);
60
61 // Add users
62 graph.addVertex("User", {
63 name: "Alice Smith",
64 email: "alice@example.com",
65 role: "admin",
66 bio: "Software engineer working on graph databases",
67 });
68 graph.addVertex("User", {
69 name: "Bob Johnson",
70 email: "bob@company.org",
71 role: "user",
72 bio: "Product manager with 10 years experience",
73 });
74 graph.addVertex("User", {
75 name: "Charlie Brown",
76 email: "charlie@example.com",
77 role: "admin",
78 bio: "DevOps specialist focusing on cloud infrastructure",
79 });
80 graph.addVertex("User", {
81 name: "Diana Prince",
82 email: "diana@company.org",
83 role: "moderator",
84 bio: "Community manager and support lead",
85 });
86
87 // Add products
88 graph.addVertex("Product", {
89 name: "Graph Database Pro",
90 sku: "DB-001",
91 description: "Professional graph database solution",
92 });
93 graph.addVertex("Product", {
94 name: "Analytics Dashboard",
95 sku: "AN-001",
96 description: "Data analytics and visualization tool",
97 });
98 graph.addVertex("Product", {
99 name: "Developer Tools Suite",
100 sku: "DEV-100",
101 description: "Complete developer productivity tools",
102 });
103
104 return { graph, g };
105}
106
107test("String Predicate Traversals - startsWith - should filter vertices where property starts with value", () => {
108 const { g } = createGraph();

Calls 1

addVertexMethod · 0.95

Tested by

no test coverage detected