Skip to content

Commit

Permalink
test(firestore): add additional test verifying deleting a map value v…
Browse files Browse the repository at this point in the history
…ia update (#4026)
  • Loading branch information
crwilcox committed Apr 29, 2021
1 parent 80fbb02 commit aab30c6
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions firestore/integration_test.go
Expand Up @@ -462,6 +462,19 @@ func TestIntegration_Update(t *testing.T) {
er(doc.Update(ctx, fpus, LastUpdateTime(wr.UpdateTime.Add(-time.Millisecond)))))
codeEq(t, "Update with right LastUpdateTime", codes.OK,
er(doc.Update(ctx, fpus, LastUpdateTime(wr.UpdateTime))))

// Verify that map value deletion is respected
fpus = []Update{
{FieldPath: []string{"*", "`"}, Value: Delete},
}
_ = h.mustUpdate(doc, fpus)
ds = h.mustGet(doc)
got = ds.Data()
want = copyMap(want)
want["*"] = map[string]interface{}{}
if !testEqual(got, want) {
t.Errorf("got\n%#v\nwant\n%#v", got, want)
}
}

func TestIntegration_Collections(t *testing.T) {
Expand Down

0 comments on commit aab30c6

Please sign in to comment.