master
Bel LaPointe 2020-07-23 16:46:04 -06:00
parent bed265a228
commit ef27716695
2 changed files with 8 additions and 8 deletions

View File

@ -32,7 +32,7 @@ func (bdb *BoltDB) count(ctx context.Context, namespace string, filter interface
ch, err := bdb.Find(ctx, namespace, filter)
n := 0
for _ = range ch {
n += 1
n++
}
return n, err
}

View File

@ -40,7 +40,7 @@ func TestBoltDBCount(t *testing.T) {
t.Fatal(err)
}
ones[i] = o
i += 1
i++
}
for name, filter := range map[string]struct {
@ -72,11 +72,11 @@ func TestBoltDBCount(t *testing.T) {
match: true,
},
"name:$regex[gibberish]": {
filter: operator.Regex{entity.Name, ones[3].Name + ones[4].Name},
filter: operator.Regex{Key: entity.Name, Value: ones[3].Name + ones[4].Name},
match: false,
},
"name:$regex[name]": {
filter: operator.Regex{entity.Name, ones[3].Name},
filter: operator.Regex{Key: entity.Name, Value: ones[3].Name},
match: true,
},
} {
@ -105,7 +105,7 @@ func TestBoltDBFind(t *testing.T) {
}
n := 0
for b := range ch {
n += 1
n++
o := entity.One{}
if err := bson.Unmarshal(b, &o); err != nil {
t.Fatal(err)
@ -175,20 +175,20 @@ func TestBoltDBDelete(t *testing.T) {
t.Fatal(err)
}
ones[i] = o
i += 1
i++
}
wantN := testN
for _, filter := range []interface{}{
ones[0].Query(),
operator.NewFilterIn(entity.Title, []string{ones[1].Title}),
operator.Regex{entity.Text, ones[2].Text},
operator.Regex{Key: entity.Text, Value: ones[2].Text},
} {
err = bdb.Delete(context.TODO(), testNS, filter)
if err != nil {
t.Fatal(err)
}
wantN -= 1
wantN--
n, err := bdb.count(context.TODO(), testNS, map[string]string{})
if err != nil {
t.Fatal(err)