-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: sembast support for list collections
- Loading branch information
1 parent
cea9dcf
commit b4beabd
Showing
5 changed files
with
84 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// ignore_for_file: inference_failure_on_collection_literal | ||
|
||
import 'package:path/path.dart'; | ||
import 'package:tekartik_firebase_firestore/firestore.dart'; | ||
// ignore: implementation_imports | ||
import 'package:tekartik_firebase_firestore_test/utils_test.dart'; | ||
import 'package:test/test.dart'; | ||
|
||
void runListCollectionsTest({ | ||
required Firestore firestore, | ||
}) { | ||
test('list root collections', () async { | ||
var collectionId = 'tekartik_test_root_collection'; | ||
var doc = firestore.doc('$collectionId/doc'); | ||
await doc.set({}); | ||
var collections = await firestore.listCollections(); | ||
var collection = | ||
collections.firstWhere((element) => element.id == collectionId); | ||
expect(collection.path, collectionId); | ||
await doc.delete(); | ||
}, solo: true, skip: !firestore.service.supportsListCollections); | ||
|
||
test('list doc collections', () async { | ||
var parent = url.join(testsRefPath, 'tekartik_test_collection'); | ||
var collectionId = 'sub'; | ||
var doc = firestore.doc('$parent/$collectionId/doc'); | ||
await doc.set({}); | ||
var collections = await firestore.doc(parent).listCollections(); | ||
expect(collections.map((e) => e.id), contains(collectionId)); | ||
await doc.delete(); | ||
}, skip: !firestore.service.supportsListCollections); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters