MCPcopy Index your code
hub / github.com/github/github-mcp-server / TestGenerateInstructions

Function TestGenerateInstructions

pkg/inventory/instructions_test.go:28–80  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

26}
27
28func TestGenerateInstructions(t *testing.T) {
29 tests := []struct {
30 name string
31 toolsets []ToolsetMetadata
32 expectedEmpty bool
33 }{
34 {
35 name: "empty toolsets",
36 toolsets: []ToolsetMetadata{},
37 expectedEmpty: false, // base instructions are always included
38 },
39 {
40 name: "toolset with instructions",
41 toolsets: []ToolsetMetadata{
42 {
43 ID: "test",
44 Description: "Test toolset",
45 InstructionsFunc: func(_ *Inventory) string {
46 return "Test instructions"
47 },
48 },
49 },
50 expectedEmpty: false,
51 },
52 {
53 name: "toolset without instructions",
54 toolsets: []ToolsetMetadata{
55 {
56 ID: "test",
57 Description: "Test toolset",
58 },
59 },
60 expectedEmpty: false, // base instructions still included
61 },
62 }
63
64 for _, tt := range tests {
65 t.Run(tt.name, func(t *testing.T) {
66 inv := createTestInventory(tt.toolsets)
67 result := generateInstructions(inv)
68
69 if tt.expectedEmpty {
70 if result != "" {
71 t.Errorf("Expected empty instructions but got: %s", result)
72 }
73 } else {
74 if result == "" {
75 t.Errorf("Expected non-empty instructions but got empty result")
76 }
77 }
78 })
79 }
80}
81
82func TestGenerateInstructionsWithDisableFlag(t *testing.T) {
83 tests := []struct {

Callers

nothing calls this directly

Calls 2

createTestInventoryFunction · 0.85
generateInstructionsFunction · 0.85

Tested by

no test coverage detected