Sanitize at API level

This commit is contained in:
breel
2020-07-25 19:40:31 -06:00
parent a1d59a0248
commit 09507d38e9
4 changed files with 88 additions and 20 deletions

View File

@@ -126,6 +126,51 @@ func TestIntegration(t *testing.T) {
}
})
t.Run("graph.Delete(case insensitives() => 0)", func(t *testing.T) {
cleanFill()
err := graph.Delete(ctx, "col", operator.CaseInsensitives{Key: entity.Name, Values: []string{}})
if err != nil {
t.Fatal(err)
}
ones, err := graph.List(ctx, "col")
if err != nil {
t.Fatal(err)
}
if len(ones) != 0 {
t.Fatal(len(ones))
}
})
t.Run("graph.Delete(case insensitives(.*) => 0)", func(t *testing.T) {
cleanFill()
err := graph.Delete(ctx, "col", operator.CaseInsensitives{Key: entity.Name, Values: []string{".*"}})
if err != nil {
t.Fatal(err)
}
ones, err := graph.List(ctx, "col")
if err != nil {
t.Fatal(err)
}
if len(ones) < 0 {
t.Fatal(len(ones))
}
})
t.Run("graph.Delete(case insensitive(.*) => 0)", func(t *testing.T) {
cleanFill()
err := graph.Delete(ctx, "col", operator.CaseInsensitive{Key: entity.Name, Value: ".*"})
if err != nil {
t.Fatal(err)
}
ones, err := graph.List(ctx, "col")
if err != nil {
t.Fatal(err)
}
if len(ones) < 0 {
t.Fatal(len(ones))
}
})
t.Run("graph.Search(foo => *)", func(t *testing.T) {
cleanFill()
some, err := graph.Search(ctx, "col", ones[0].Name[:3])