Compatible with both bolt and mongo, wewt

This commit is contained in:
Bel LaPointe
2020-07-23 20:01:09 -06:00
parent 99885da94f
commit 4416a7e4b3
3 changed files with 57 additions and 2 deletions

View File

@@ -179,6 +179,10 @@ func TestBoltDBUpdate(t *testing.T) {
t.Fatal(err)
}
if err := bdb.Update(context.TODO(), testNS, ones[0].Query(), operator.Unset(entity.Type)); err != nil {
t.Fatal(err)
}
if n, err := bdb.count(context.TODO(), testNS, map[string]string{}); err != nil {
t.Fatal(err)
} else if n != testN {
@@ -202,6 +206,9 @@ func TestBoltDBUpdate(t *testing.T) {
if err := bson.Unmarshal(j, &o); err != nil {
t.Fatal(err)
}
if o.Type != "" {
t.Fatalf("doc still has Type even though $unset called: %+v", o)
}
if fmt.Sprint(ones[0]) == fmt.Sprint(o) {
t.Fatal(ones[0], o)
}
@@ -210,6 +217,11 @@ func TestBoltDBUpdate(t *testing.T) {
if fmt.Sprint(ones[0]) == fmt.Sprint(o) {
t.Fatal(ones[0], o)
}
ones[0].Type = ""
o.Type = ""
if fmt.Sprint(ones[0]) == fmt.Sprint(o) {
t.Fatal(ones[0], o)
}
ones[0].Modified = 0
o.Modified = 0
if fmt.Sprint(ones[0]) != fmt.Sprint(o) {