Files
openserp/yandex/search_test.go
Rustem Kamalov ecacfab4d6 Add integration tests for multiple search engines and enhance error handling
- Implement integration tests for Baidu, Bing, DuckDuckGo, Google, and Yandex.
- Refactor test utility functions to avoid core import cycles.
2026-04-14 02:05:58 +03:00

43 lines
970 B
Go

//go:build integration
// +build integration
package yandex
import (
"testing"
"github.com/karust/openserp/core"
"github.com/karust/openserp/testutil"
"github.com/karust/openserp/testutil/ithelper"
)
func TestSearchYandex(t *testing.T) {
testutil.RequireIntegration(t)
browser := ithelper.CreateBrowser(t)
yand := New(*browser, core.SearchEngineOptions{})
query := core.Query{Text: "HEY", Limit: 10}
results, err := yand.Search(query)
ithelper.HandleError(t, "yandex web search", err)
if len(results) == 0 {
t.Fatalf("[SearchYandex] returned empty result")
}
}
func TestImageYandex(t *testing.T) {
testutil.RequireIntegration(t)
browser := ithelper.CreateBrowser(t)
yand := New(*browser, core.SearchEngineOptions{})
query := core.Query{Text: "furry tiger", Limit: 30}
results, err := yand.SearchImage(query)
ithelper.HandleError(t, "yandex image search", err)
if len(results) == 0 {
t.Fatalf("[ImageYandex] returned empty result")
}
}