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

Function createTestGraph

packages/graph/src/test/negativeAndRegex.test.ts:7–98  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

5import { makeType, executeQuery } from "./testHelpers.js";
6
7function createTestGraph(): Graph<GraphSchema> {
8 const schema = {
9 vertices: {
10 Sensor: {
11 properties: {
12 name: { type: makeType<string>("") },
13 temperature: { type: makeType<number>(0) },
14 humidity: { type: makeType<number>(0) },
15 location: { type: makeType<string>("") },
16 status: { type: makeType<string>("") },
17 },
18 },
19 Product: {
20 properties: {
21 sku: { type: makeType<string>("") },
22 name: { type: makeType<string>("") },
23 price: { type: makeType<number>(0) },
24 },
25 },
26 },
27 edges: {
28 monitors: {
29 properties: {},
30 },
31 },
32 } as const satisfies GraphSchema;
33
34 const graph = new Graph({ schema, storage: new InMemoryGraphStorage() });
35
36 // Add sensors with various temperatures (including negative)
37 graph.addVertex("Sensor", {
38 name: "Arctic-1",
39 temperature: -40,
40 humidity: 20,
41 location: "arctic-base-alpha",
42 status: "active",
43 });
44 graph.addVertex("Sensor", {
45 name: "Arctic-2",
46 temperature: -25,
47 humidity: 35,
48 location: "arctic-base-beta",
49 status: "maintenance",
50 });
51 graph.addVertex("Sensor", {
52 name: "Freezer-1",
53 temperature: -18,
54 humidity: 45,
55 location: "warehouse-a",
56 status: "active",
57 });
58 graph.addVertex("Sensor", {
59 name: "Room-1",
60 temperature: 22,
61 humidity: 50,
62 location: "office-floor-1",
63 status: "active",
64 });

Callers 1

Calls 2

addVertexMethod · 0.95
makeTypeFunction · 0.70

Tested by

no test coverage detected