Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 24 additions & 2 deletions src/semantic-router/pkg/services/classification_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (
)

func TestNewUnifiedClassificationService(t *testing.T) {
// Test with nil unified classifier (this is expected to work)
// Test with nil unified classifier and nil legacy classifier (this is expected to work)
config := &config.RouterConfig{}
service := NewUnifiedClassificationService(nil, config)
service := NewUnifiedClassificationService(nil, nil, config)

if service == nil {
t.Error("Expected non-nil service")
Expand All @@ -26,6 +26,28 @@ func TestNewUnifiedClassificationService(t *testing.T) {
}
}

func TestNewUnifiedClassificationService_WithBothClassifiers(t *testing.T) {
// Test with both unified and legacy classifiers
config := &config.RouterConfig{}
unifiedClassifier := &classification.UnifiedClassifier{}
legacyClassifier := &classification.Classifier{}

service := NewUnifiedClassificationService(unifiedClassifier, legacyClassifier, config)

if service == nil {
t.Error("Expected non-nil service")
}
if service.classifier != legacyClassifier {
t.Error("Expected legacy classifier to match provided classifier")
}
if service.unifiedClassifier != unifiedClassifier {
t.Error("Expected unified classifier to match provided classifier")
}
if service.config != config {
t.Error("Expected config to match")
}
}

func TestClassificationService_HasUnifiedClassifier(t *testing.T) {
t.Run("No_classifier", func(t *testing.T) {
service := &ClassificationService{
Expand Down
Loading