From aab30c6a50948fd8244e227b122e7c513ae23cee Mon Sep 17 00:00:00 2001 From: Christopher Wilcox Date: Thu, 29 Apr 2021 13:08:46 -0700 Subject: [PATCH] test(firestore): add additional test verifying deleting a map value via update (#4026) --- firestore/integration_test.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/firestore/integration_test.go b/firestore/integration_test.go index 57d5479dc55..e398150f84f 100644 --- a/firestore/integration_test.go +++ b/firestore/integration_test.go @@ -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) {