MCPcopy Create free account
hub / github.com/diillson/chatcli / sampleGraph

Function sampleGraph

pkg/knowledge/graph_test.go:15–31  ·  view source on GitHub ↗

sampleGraph builds a small graph: a topic hub linked to three facts, one of which belongs to a project; a skill linked to the topic; plus an isolated tag.

()

Source from the content-addressed store, hash-verified

13// sampleGraph builds a small graph: a topic hub linked to three facts, one of
14// which belongs to a project; a skill linked to the topic; plus an isolated tag.
15func sampleGraph() *Graph {
16 g := New()
17 g.AddNode(Node{ID: "topic:auth", Kind: KindTopic, Title: "auth", Weight: 5})
18 g.AddNode(Node{ID: "fact:1", Kind: KindFact, Title: "uses OAuth", Summary: "the app uses OAuth2 PKCE", Weight: 3})
19 g.AddNode(Node{ID: "fact:2", Kind: KindFact, Title: "token TTL", Summary: "tokens live 1h", Weight: 2})
20 g.AddNode(Node{ID: "fact:3", Kind: KindFact, Title: "login flow", Summary: "loopback login", Weight: 1})
21 g.AddNode(Node{ID: "project:app", Kind: KindProject, Title: "app", Weight: 4})
22 g.AddNode(Node{ID: "skill:deploy", Kind: KindSkill, Title: "deploy", Summary: "how to deploy", Weight: 1})
23 g.AddNode(Node{ID: "tag:lonely", Kind: KindTag, Title: "lonely"})
24
25 g.AddEdge("topic:auth", "fact:1", 2)
26 g.AddEdge("topic:auth", "fact:2", 2)
27 g.AddEdge("topic:auth", "fact:3", 1)
28 g.AddEdge("fact:1", "project:app", 1)
29 g.AddEdge("skill:deploy", "topic:auth", 1)
30 return g
31}
32
33func TestAddNodeUpsertAndEdgeGuards(t *testing.T) {
34 g := New()

Callers 3

TestNeighborsHubsSearchFunction · 0.85
TestNeighborhoodBFSFunction · 0.85
TestIndexCardFunction · 0.85

Calls 3

AddNodeMethod · 0.80
AddEdgeMethod · 0.80
NewFunction · 0.70

Tested by

no test coverage detected