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.
()
| 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. |
| 15 | func 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 | |
| 33 | func TestAddNodeUpsertAndEdgeGuards(t *testing.T) { |
| 34 | g := New() |
no test coverage detected