Add graph.Search for substr

This commit is contained in:
Bel LaPointe
2020-07-22 22:42:21 -06:00
parent 660cd64262
commit db1c36fc0f
3 changed files with 46 additions and 7 deletions

View File

@@ -20,7 +20,7 @@ func TestIntegration(t *testing.T) {
os.Args = os.Args[:1]
graph := NewGraph()
graph.mongo.db = "test-db"
graph.mongo.db = "db"
ctx, can := context.WithCancel(context.TODO())
defer can()
clean := func() {
@@ -67,6 +67,17 @@ func TestIntegration(t *testing.T) {
}
})
t.Run("graph.Search(foo => *)", func(t *testing.T) {
some, err := graph.Search(ctx, "col", ones[0].Name[:3])
if err != nil {
t.Fatal(err)
}
t.Logf("searching for %s (%s)\nsom = %+v", ones[0].Name, ones[0].Name[:3], some)
if len(some) < 1 {
t.Fatalf("%+v: %+v", len(some), some)
}
})
t.Run("graph.Update(foo, --bar)", func(t *testing.T) {
err := graph.Update(ctx, "col", ones[0].Query(), operator.Set{entity.Connections, map[string]interface{}{}})
if err != nil {