单元测试查询
This commit is contained in:
@@ -6,11 +6,11 @@ import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestMyFunction(t *testing.T) {
|
||||
func TestElasticsearchSearch(t *testing.T) {
|
||||
// 创建一个测试用例
|
||||
expected := 10
|
||||
expected := "植物学家 阿尔法 可复活一次 技能:召唤豌豆射手 转到设置"
|
||||
actual := ElasticsearchSearch("豌豆")
|
||||
|
||||
// 使用 assert 包中的函数来验证函数的输出
|
||||
assert.Equal(t, expected, actual)
|
||||
assert.Equal(t, expected, actual.Hits.Hits[0].Source.Content)
|
||||
}
|
||||
|
Reference in New Issue
Block a user