verstak/internal/core/nodes/search_test.go

24 lines
399 B
Go

package nodes
import (
"testing"
)
func TestSearchFindsCreatedNode(t *testing.T) {
db := openTestDB(t)
repo := NewRepository(db)
_, err := repo.Create(nil, TypeCase, "TestNode_ABC", 0, "", "")
if err != nil {
t.Fatal(err)
}
results, err := repo.Search("testnode", 20)
if err != nil {
t.Fatal(err)
}
if len(results) != 1 {
t.Errorf("expected 1 result, got %d", len(results))
}
}