Skip to content

Commit c727323

Browse files
janiszclaude
andcommitted
test: move comprehensive TestGetToolsets to app package
Replace simple test with comprehensive version that verifies specific toolset names are present. This test was previously in cmd/stackrox-mcp/main_test.go and is now in the proper location alongside the GetToolsets function. Addresses PR #50 review comment #3 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 6424c85 commit c727323

1 file changed

Lines changed: 8 additions & 20 deletions

File tree

internal/app/app_test.go

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,19 @@ package app
33
import (
44
"testing"
55

6+
"github.com/stackrox/stackrox-mcp/internal/client"
67
"github.com/stackrox/stackrox-mcp/internal/config"
78
"github.com/stretchr/testify/assert"
8-
"github.com/stretchr/testify/require"
99
)
1010

1111
func TestGetToolsets(t *testing.T) {
12-
cfg := &config.Config{
13-
Central: config.CentralConfig{
14-
URL: "https://example.com",
15-
},
16-
Tools: config.ToolsConfig{
17-
ConfigManager: config.ToolConfigManagerConfig{
18-
Enabled: false,
19-
},
20-
Vulnerability: config.ToolsetVulnerabilityConfig{
21-
Enabled: true,
22-
},
23-
},
24-
}
12+
allToolsets := GetToolsets(&config.Config{}, &client.Client{})
2513

26-
// We can't create a real client without a valid connection,
27-
// so we pass nil and just test that getToolsets returns something
28-
toolsets := getToolsets(cfg, nil)
14+
toolsetNames := []string{}
15+
for _, toolset := range allToolsets {
16+
toolsetNames = append(toolsetNames, toolset.GetName())
17+
}
2918

30-
require.NotNil(t, toolsets, "getToolsets should return a non-nil slice")
31-
assert.NotEmpty(t, toolsets, "getToolsets should return at least one toolset")
32-
assert.Len(t, toolsets, 2, "getToolsets should return 2 toolsets")
19+
assert.Contains(t, toolsetNames, "config_manager")
20+
assert.Contains(t, toolsetNames, "vulnerability")
3321
}

0 commit comments

Comments
 (0)