chore: align slurp config and scaffolding
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
//go:build integration
|
||||
// +build integration
|
||||
|
||||
package intelligence
|
||||
|
||||
import (
|
||||
@@ -13,12 +16,12 @@ import (
|
||||
func TestIntelligenceEngine_Integration(t *testing.T) {
|
||||
// Create test configuration
|
||||
config := &EngineConfig{
|
||||
EnableRAG: false, // Disable RAG for testing
|
||||
EnableGoalAlignment: true,
|
||||
EnablePatternDetection: true,
|
||||
EnableRoleAware: true,
|
||||
MaxConcurrentAnalysis: 2,
|
||||
AnalysisTimeout: 30 * time.Second,
|
||||
EnableRAG: false, // Disable RAG for testing
|
||||
EnableGoalAlignment: true,
|
||||
EnablePatternDetection: true,
|
||||
EnableRoleAware: true,
|
||||
MaxConcurrentAnalysis: 2,
|
||||
AnalysisTimeout: 30 * time.Second,
|
||||
CacheTTL: 5 * time.Minute,
|
||||
MinConfidenceThreshold: 0.5,
|
||||
}
|
||||
@@ -29,13 +32,13 @@ func TestIntelligenceEngine_Integration(t *testing.T) {
|
||||
|
||||
// Create test context node
|
||||
testNode := &slurpContext.ContextNode{
|
||||
Path: "/test/example.go",
|
||||
Summary: "A Go service implementing user authentication",
|
||||
Purpose: "Handles user login and authentication for the web application",
|
||||
Path: "/test/example.go",
|
||||
Summary: "A Go service implementing user authentication",
|
||||
Purpose: "Handles user login and authentication for the web application",
|
||||
Technologies: []string{"go", "jwt", "bcrypt"},
|
||||
Tags: []string{"authentication", "security", "web"},
|
||||
CreatedAt: time.Now(),
|
||||
UpdatedAt: time.Now(),
|
||||
Tags: []string{"authentication", "security", "web"},
|
||||
GeneratedAt: time.Now(),
|
||||
UpdatedAt: time.Now(),
|
||||
}
|
||||
|
||||
// Create test project goal
|
||||
@@ -47,7 +50,7 @@ func TestIntelligenceEngine_Integration(t *testing.T) {
|
||||
Priority: 1,
|
||||
Phase: "development",
|
||||
Deadline: nil,
|
||||
CreatedAt: time.Now(),
|
||||
GeneratedAt: time.Now(),
|
||||
}
|
||||
|
||||
t.Run("AnalyzeFile", func(t *testing.T) {
|
||||
@@ -220,9 +223,9 @@ func TestPatternDetector_DetectDesignPatterns(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
filename string
|
||||
content []byte
|
||||
name string
|
||||
filename string
|
||||
content []byte
|
||||
expectedPattern string
|
||||
}{
|
||||
{
|
||||
@@ -244,7 +247,7 @@ func TestPatternDetector_DetectDesignPatterns(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "Go Factory Pattern",
|
||||
filename: "factory.go",
|
||||
filename: "factory.go",
|
||||
content: []byte(`
|
||||
package main
|
||||
func NewUser(name string) *User {
|
||||
@@ -312,7 +315,7 @@ func TestGoalAlignment_DimensionCalculators(t *testing.T) {
|
||||
testNode := &slurpContext.ContextNode{
|
||||
Path: "/test/auth.go",
|
||||
Summary: "User authentication service with JWT tokens",
|
||||
Purpose: "Handles user login and token generation",
|
||||
Purpose: "Handles user login and token generation",
|
||||
Technologies: []string{"go", "jwt", "bcrypt"},
|
||||
Tags: []string{"authentication", "security"},
|
||||
}
|
||||
@@ -470,7 +473,7 @@ func TestRoleAwareProcessor_AccessControl(t *testing.T) {
|
||||
hasAccess := err == nil
|
||||
|
||||
if hasAccess != tc.expected {
|
||||
t.Errorf("Expected access %v for role %s, action %s, resource %s, got %v",
|
||||
t.Errorf("Expected access %v for role %s, action %s, resource %s, got %v",
|
||||
tc.expected, tc.roleID, tc.action, tc.resource, hasAccess)
|
||||
}
|
||||
})
|
||||
@@ -491,7 +494,7 @@ func TestDirectoryAnalyzer_StructureAnalysis(t *testing.T) {
|
||||
// Create test structure
|
||||
testDirs := []string{
|
||||
"src/main",
|
||||
"src/lib",
|
||||
"src/lib",
|
||||
"test/unit",
|
||||
"test/integration",
|
||||
"docs/api",
|
||||
@@ -504,7 +507,7 @@ func TestDirectoryAnalyzer_StructureAnalysis(t *testing.T) {
|
||||
if err := os.MkdirAll(fullPath, 0755); err != nil {
|
||||
t.Fatalf("Failed to create directory %s: %v", fullPath, err)
|
||||
}
|
||||
|
||||
|
||||
// Create a dummy file in each directory
|
||||
testFile := filepath.Join(fullPath, "test.txt")
|
||||
if err := os.WriteFile(testFile, []byte("test content"), 0644); err != nil {
|
||||
@@ -652,7 +655,7 @@ func createTestContextNode(path, summary, purpose string, technologies, tags []s
|
||||
Purpose: purpose,
|
||||
Technologies: technologies,
|
||||
Tags: tags,
|
||||
CreatedAt: time.Now(),
|
||||
GeneratedAt: time.Now(),
|
||||
UpdatedAt: time.Now(),
|
||||
}
|
||||
}
|
||||
@@ -665,7 +668,7 @@ func createTestProjectGoal(id, name, description string, keywords []string, prio
|
||||
Keywords: keywords,
|
||||
Priority: priority,
|
||||
Phase: phase,
|
||||
CreatedAt: time.Now(),
|
||||
GeneratedAt: time.Now(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -697,4 +700,4 @@ func assertValidDimensionScore(t *testing.T, score *DimensionScore) {
|
||||
if score.Confidence <= 0 || score.Confidence > 1 {
|
||||
t.Errorf("Invalid confidence: %f", score.Confidence)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user