mirror of
https://github.com/danielmiessler/Fabric.git
synced 2026-01-09 14:28:01 -05:00
44 lines
859 B
Go
44 lines
859 B
Go
package gemini
|
|
|
|
import (
|
|
"github.com/google/generative-ai-go/genai"
|
|
"testing"
|
|
)
|
|
|
|
// Test generated using Keploy
|
|
func TestBuildModelNameSimple(t *testing.T) {
|
|
client := &Client{}
|
|
fullModelName := "models/chat-bison-001"
|
|
expected := "chat-bison-001"
|
|
|
|
result := client.buildModelNameSimple(fullModelName)
|
|
|
|
if result != expected {
|
|
t.Errorf("Expected %v, got %v", expected, result)
|
|
}
|
|
}
|
|
|
|
// Test generated using Keploy
|
|
func TestExtractText(t *testing.T) {
|
|
client := &Client{}
|
|
response := &genai.GenerateContentResponse{
|
|
Candidates: []*genai.Candidate{
|
|
{
|
|
Content: &genai.Content{
|
|
Parts: []genai.Part{
|
|
genai.Text("Hello, "),
|
|
genai.Text("world!"),
|
|
},
|
|
},
|
|
},
|
|
},
|
|
}
|
|
expected := "Hello, world!"
|
|
|
|
result := client.extractText(response)
|
|
|
|
if result != expected {
|
|
t.Errorf("Expected %v, got %v", expected, result)
|
|
}
|
|
}
|