Skip to content

Commit 062367b

Browse files
authored
fix: use classification unit test (#333)
Signed-off-by: Huamin Chen <[email protected]>
1 parent ce0cec2 commit 062367b

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

src/semantic-router/pkg/services/classification_test.go

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ import (
88
)
99

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

1515
if service == nil {
1616
t.Error("Expected non-nil service")
@@ -26,6 +26,28 @@ func TestNewUnifiedClassificationService(t *testing.T) {
2626
}
2727
}
2828

29+
func TestNewUnifiedClassificationService_WithBothClassifiers(t *testing.T) {
30+
// Test with both unified and legacy classifiers
31+
config := &config.RouterConfig{}
32+
unifiedClassifier := &classification.UnifiedClassifier{}
33+
legacyClassifier := &classification.Classifier{}
34+
35+
service := NewUnifiedClassificationService(unifiedClassifier, legacyClassifier, config)
36+
37+
if service == nil {
38+
t.Error("Expected non-nil service")
39+
}
40+
if service.classifier != legacyClassifier {
41+
t.Error("Expected legacy classifier to match provided classifier")
42+
}
43+
if service.unifiedClassifier != unifiedClassifier {
44+
t.Error("Expected unified classifier to match provided classifier")
45+
}
46+
if service.config != config {
47+
t.Error("Expected config to match")
48+
}
49+
}
50+
2951
func TestClassificationService_HasUnifiedClassifier(t *testing.T) {
3052
t.Run("No_classifier", func(t *testing.T) {
3153
service := &ClassificationService{

0 commit comments

Comments
 (0)