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

Function createMockPath

packages/graph/src/test/orderByAndForeach.test.ts:67–81  ·  view source on GitHub ↗
(properties: Record<string, any>)

Source from the content-addressed store, hash-verified

65
66// Helper function to create mock TraversalPath objects for testing
67function createMockPath(properties: Record<string, any>): TraversalPath<undefined, any, []> {
68 // Create a mock vertex for testing
69 // TraversalPath.property() checks if value is an Element, then object with direct properties
70 // We need to add properties directly on the object for the fallback case to work
71 const mockVertex = {
72 id: Math.random().toString(),
73 label: "Person",
74 get: (key: string) => properties[key],
75 properties: () => properties,
76 // Add properties directly for TraversalPath.property() to work
77 ...properties,
78 };
79
80 return new TraversalPath(undefined, mockVertex, []);
81}
82
83function setupOrderByGraph(): Graph<TestSchema> {
84 const graph = new Graph({

Callers 1

Calls 1

toStringMethod · 0.65

Tested by

no test coverage detected