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

Auto ID for document() #22

Merged
merged 3 commits into from
Mar 1, 2020
Merged

Auto ID for document() #22

merged 3 commits into from
Mar 1, 2020

Conversation

suztomo
Copy link
Collaborator

@suztomo suztomo commented Feb 26, 2020

Fixes #14 .

Due to complexity in updating tests, I left the behavior of document.add unchanged. For example, https://github.com/atn832/cloud_firestore_mocks/pull/22/files#diff-e8ee19ddcfe4302627bdf8313dad3f9bR280 Expecting document ID “zz”

expect(snapshot1.documentID, nonExistentId);
// TODO: data field should be null before the document is saved
// https://github.com/atn832/cloud_firestore_mocks/issues/21
// expect(snapshot1.data, isNull);
Copy link
Collaborator Author

@suztomo suztomo Feb 26, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This assertion fails under current implementation. It’s unexpectedly an empty map.

QuerySnapshot querySnapshot =
await firestore.collection('users').getDocuments();
// TODO: assert result length size. It should be 1.
// https://github.com/atn832/cloud_firestore_mocks/issues/20
Copy link
Collaborator Author

@suztomo suztomo Feb 26, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Under current implementation, the query snapshot unexpectedly holds 2 documents.

@atn832 atn832 merged commit 53900a4 into atn832:master Mar 1, 2020
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

Successfully merging this pull request may close these issues.

collection.document() to assign a random ID to the document reference
2 participants