Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ArrayUnion should only add elements not already present #58

Open
hellojappie opened this issue Mar 3, 2022 · 0 comments
Open

ArrayUnion should only add elements not already present #58

hellojappie opened this issue Mar 3, 2022 · 0 comments

Comments

@hellojappie
Copy link

According to the documentation ArrayUnion should only add elements that aren't already present in the array. E.g. this test should succeed:

    def test_document_update_transformerArrayUnionDuplicates(self):
        fs = MockFirestore()
        fs._data = {"foo": {"first": {"arr": [1, 3]}}}
        fs.collection("foo").document("first").update(
            {"arr": firestore.ArrayUnion([2, 3, 4])}
        )
        doc = fs.collection("foo").document("first").get().to_dict()
        self.assertCountEqual(doc["arr"], [1, 2, 3, 4])  # fails: doc["arr"] = [1, 3, 2, 3, 4]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant