From b70d8302be44226e4958a635b6111b212c8c1a80 Mon Sep 17 00:00:00 2001 From: Yeuoly Date: Wed, 4 Sep 2024 15:27:46 +0800 Subject: [PATCH] fix: tests --- .../plugin_entities/tool_declaration.go | 2 +- .../plugin_entities/tool_declaration_test.go | 26 +++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/internal/types/entities/plugin_entities/tool_declaration.go b/internal/types/entities/plugin_entities/tool_declaration.go index 75f275c..a8b8acd 100644 --- a/internal/types/entities/plugin_entities/tool_declaration.go +++ b/internal/types/entities/plugin_entities/tool_declaration.go @@ -221,7 +221,7 @@ func init() { validators.GlobalEntitiesValidator.RegisterValidation("is_basic_type", isBasicType) } -func UnmarshalToolProviderConfiguration(data []byte) (*ToolProviderDeclaration, error) { +func UnmarshalToolProviderDeclaration(data []byte) (*ToolProviderDeclaration, error) { obj, err := parser.UnmarshalJsonBytes[ToolProviderDeclaration](data) if err != nil { return nil, fmt.Errorf("failed to unmarshal tool provider configuration: %w", err) diff --git a/internal/types/entities/plugin_entities/tool_declaration_test.go b/internal/types/entities/plugin_entities/tool_declaration_test.go index 558d850..bedd85d 100644 --- a/internal/types/entities/plugin_entities/tool_declaration_test.go +++ b/internal/types/entities/plugin_entities/tool_declaration_test.go @@ -104,7 +104,7 @@ func TestFullFunctionToolProvider_Validate(t *testing.T) { } ` - _, err := UnmarshalToolProviderConfiguration([]byte(data)) + _, err := UnmarshalToolProviderDeclaration([]byte(data)) if err != nil { t.Errorf("UnmarshalToolProviderConfiguration() error = %v", err) return @@ -162,7 +162,7 @@ func TestWithoutAuthorToolProvider_Validate(t *testing.T) { } ` - _, err := UnmarshalToolProviderConfiguration([]byte(data)) + _, err := UnmarshalToolProviderDeclaration([]byte(data)) if err == nil { t.Errorf("UnmarshalToolProviderConfiguration() error = %v, wantErr %v", err, true) return @@ -220,7 +220,7 @@ func TestWithoutNameToolProvider_Validate(t *testing.T) { } ` - _, err := UnmarshalToolProviderConfiguration([]byte(data)) + _, err := UnmarshalToolProviderDeclaration([]byte(data)) if err == nil { t.Errorf("UnmarshalToolProviderConfiguration() error = %v, wantErr %v", err, true) return @@ -274,7 +274,7 @@ func TestWithoutDescriptionToolProvider_Validate(t *testing.T) { } ` - _, err := UnmarshalToolProviderConfiguration([]byte(data)) + _, err := UnmarshalToolProviderDeclaration([]byte(data)) if err == nil { t.Errorf("UnmarshalToolProviderConfiguration() error = %v, wantErr %v", err, true) return @@ -333,7 +333,7 @@ func TestWrongCredentialTypeToolProvider_Validate(t *testing.T) { } ` - _, err := UnmarshalToolProviderConfiguration([]byte(data)) + _, err := UnmarshalToolProviderDeclaration([]byte(data)) if err == nil { t.Errorf("UnmarshalToolProviderConfiguration() error = %v, wantErr %v", err, true) return @@ -392,7 +392,7 @@ func TestWrongIdentityTagsToolProvider_Validate(t *testing.T) { } ` - _, err := UnmarshalToolProviderConfiguration([]byte(data)) + _, err := UnmarshalToolProviderDeclaration([]byte(data)) if err == nil { t.Errorf("UnmarshalToolProviderConfiguration() error = %v, wantErr %v", err, true) return @@ -463,7 +463,7 @@ func TestWrongToolParameterTypeToolProvider_Validate(t *testing.T) { } ` - _, err := UnmarshalToolProviderConfiguration([]byte(data)) + _, err := UnmarshalToolProviderDeclaration([]byte(data)) if err == nil { t.Errorf("UnmarshalToolProviderConfiguration() error = %v, wantErr %v", err, true) return @@ -534,7 +534,7 @@ func TestWrongToolParameterFormToolProvider_Validate(t *testing.T) { } ` - _, err := UnmarshalToolProviderConfiguration([]byte(data)) + _, err := UnmarshalToolProviderDeclaration([]byte(data)) if err == nil { t.Errorf("UnmarshalToolProviderConfiguration() error = %v, wantErr %v", err, true) return @@ -593,7 +593,7 @@ func TestJSONSchemaTypeToolProvider_Validate(t *testing.T) { } ` - _, err := UnmarshalToolProviderConfiguration([]byte(data)) + _, err := UnmarshalToolProviderDeclaration([]byte(data)) if err != nil { t.Errorf("UnmarshalToolProviderConfiguration() error = %v, wantErr %v", err, true) return @@ -652,7 +652,7 @@ func TestWrongJSONSchemaToolProvider_Validate(t *testing.T) { } ` - _, err := UnmarshalToolProviderConfiguration([]byte(data)) + _, err := UnmarshalToolProviderDeclaration([]byte(data)) if err == nil { t.Errorf("UnmarshalToolProviderConfiguration() error = %v, wantErr %v", err, true) return @@ -748,7 +748,7 @@ func TestWrongAppSelectorScopeToolProvider_Validate(t *testing.T) { } ` - _, err := UnmarshalToolProviderConfiguration([]byte(data)) + _, err := UnmarshalToolProviderDeclaration([]byte(data)) if err == nil { t.Errorf("UnmarshalToolProviderConfiguration() error = %v, wantErr %v", err, true) return @@ -760,7 +760,7 @@ func TestWrongAppSelectorScopeToolProvider_Validate(t *testing.T) { return } - if !strings.Contains(str, "ToolProviderConfiguration.Tools[0].Parameters[0].Scope") { + if !strings.Contains(str, "ToolProviderDeclaration.Tools[0].Parameters[0].Scope") { t.Errorf("UnmarshalToolProviderConfiguration() error = %v, wantErr %v", err, true) return } @@ -816,7 +816,7 @@ func TestAppSelectorScopeToolProvider_Validate(t *testing.T) { } ` - _, err := UnmarshalToolProviderConfiguration([]byte(data)) + _, err := UnmarshalToolProviderDeclaration([]byte(data)) if err != nil { t.Errorf("UnmarshalToolProviderConfiguration() error = %v, wantErr %v", err, true) return