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

Function TestGraphToDOT

cli/graph_command_test.go:29–50  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

27}
28
29func TestGraphToDOT(t *testing.T) {
30 g := dotSampleGraph()
31 include := selectFullGraphNodes(g)
32 dot := graphToDOT(g, include, "knowledge graph")
33
34 for _, want := range []string{
35 "graph knowledge {",
36 `"topic:auth" [label="auth"`,
37 `"fact:1"`,
38 " -- ", // an undirected edge
39 kindColor(knowledge.KindTopic),
40 kindColor(knowledge.KindSkill),
41 } {
42 if !strings.Contains(dot, want) {
43 t.Fatalf("DOT missing %q in:\n%s", want, dot)
44 }
45 }
46 // Edges are emitted once (deduped): exactly two among three nodes here.
47 if n := strings.Count(dot, " -- "); n != 2 {
48 t.Fatalf("expected 2 undirected edges, got %d:\n%s", n, dot)
49 }
50}
51
52func TestSelectFullGraphNodesSmallIncludesAll(t *testing.T) {
53 g := dotSampleGraph()

Callers

nothing calls this directly

Calls 5

dotSampleGraphFunction · 0.85
selectFullGraphNodesFunction · 0.85
graphToDOTFunction · 0.85
kindColorFunction · 0.85
CountMethod · 0.65

Tested by

no test coverage detected