Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Adding tests
  • Loading branch information
briblanch committed Jan 29, 2018
commit e3a65e66cf4e0ca7411249cf64fde3fd9b0bda28
34 changes: 34 additions & 0 deletions packages/cloud_firestore/test/cloud_firestore_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,19 @@ void main() {
(_) {},
);
return handle;
case 'Query#getDocuments':
return <String, dynamic>{
'paths': <String>["${methodCall.arguments['path']}/0"],
'documents': <dynamic>[kMockDocumentSnapshotData],
'documentChanges': <dynamic>[
<String, dynamic>{
'oldIndex': -1,
'newIndex': 0,
'type': 'DocumentChangeType.added',
'document': kMockDocumentSnapshotData,
},
],
};
case 'DocumentReference#setData':
return true;
case 'DocumentReference#get':
Expand Down Expand Up @@ -317,5 +330,26 @@ void main() {
expect(colRef.path, 'foo/bar/baz');
});
});

group('Query', () {
test('getDocuments', () async {
final QuerySnapshot snapshot = await collectionReference.getDocuments();
final DocumentSnapshot document = snapshot.documents.first;
expect(
log,
equals(
<Matcher>[
isMethodCall(
'Query#getDocuments',
arguments: <String, dynamic>{'path': 'foo'},
Copy link
Contributor

Choose a reason for hiding this comment

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

Update test to check for expected parameters that would go along with the getDocuments call.

),
],
),
);
expect(document.documentID, equals('0'));
expect(document.reference.path, equals('foo/0'));
expect(document.data, equals(kMockDocumentSnapshotData));
});
});
});
}