From 2e42699e8d2e918a4466c9704964e653c45a335b Mon Sep 17 00:00:00 2001 From: Huamin Chen Date: Fri, 3 Oct 2025 19:00:17 +0000 Subject: [PATCH] fix: use classification unit test Signed-off-by: Huamin Chen --- .../pkg/services/classification_test.go | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/src/semantic-router/pkg/services/classification_test.go b/src/semantic-router/pkg/services/classification_test.go index 281418d0..dc66cff6 100644 --- a/src/semantic-router/pkg/services/classification_test.go +++ b/src/semantic-router/pkg/services/classification_test.go @@ -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") @@ -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{