This commit is contained in:
@@ -88,3 +88,29 @@ func TestGeminiVisualCacheRoundTrip(t *testing.T) {
|
||||
t.Fatalf("unexpected cached visual data: %q %q", data, mimeType)
|
||||
}
|
||||
}
|
||||
|
||||
func TestGeminiTranslationCacheRoundTrip(t *testing.T) {
|
||||
service := NewGeminiService("")
|
||||
service.setCachedTranslation("비 오는 도시", "rainy city", time.Minute)
|
||||
|
||||
value, ok := service.getCachedTranslation("비 오는 도시")
|
||||
if !ok {
|
||||
t.Fatal("expected translation cache hit")
|
||||
}
|
||||
if value != "rainy city" {
|
||||
t.Fatalf("unexpected translation cache value: %q", value)
|
||||
}
|
||||
}
|
||||
|
||||
func TestGeminiExpansionCacheRoundTrip(t *testing.T) {
|
||||
service := NewGeminiService("")
|
||||
service.setCachedExpansion("city rain", []string{"city rain", "city rain stock footage"}, time.Minute)
|
||||
|
||||
value, ok := service.getCachedExpansion("city rain")
|
||||
if !ok {
|
||||
t.Fatal("expected expansion cache hit")
|
||||
}
|
||||
if len(value) != 2 || value[1] != "city rain stock footage" {
|
||||
t.Fatalf("unexpected expansion cache value: %#v", value)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user