Compatible with both bolt and mongo, wewt
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user