1
1
// Copyright 2020, the Chromium project authors. Please see the AUTHORS file
2
2
// for details. All rights reserved. Use of this source code is governed by a
3
3
// BSD-style license that can be found in the LICENSE file.
4
-
4
+ import 'dart:io' ;
5
5
import 'dart:async' ;
6
6
import 'dart:math' ;
7
7
@@ -10,6 +10,22 @@ import 'package:firebase_core/firebase_core.dart';
10
10
import 'package:flutter/foundation.dart' ;
11
11
import 'package:flutter_test/flutter_test.dart' ;
12
12
13
+ String getCurrentPlatform () {
14
+ if (kIsWeb) {
15
+ return 'web' ;
16
+ } else if (Platform .isAndroid) {
17
+ return 'android' ;
18
+ } else if (Platform .isIOS) {
19
+ return 'ios' ;
20
+ } else if (Platform .isMacOS) {
21
+ return 'macos' ;
22
+ } else if (Platform .isWindows) {
23
+ return 'windows' ;
24
+ } else {
25
+ return 'unknown' ;
26
+ }
27
+ }
28
+
13
29
void runSecondDatabaseTests () {
14
30
group ('Second Database' , () {
15
31
late FirebaseFirestore firestore;
@@ -26,8 +42,11 @@ void runSecondDatabaseTests() {
26
42
) async {
27
43
// Pushed rules which only allow database "flutterfire-2" to have "flutterfire-2" collection writes
28
44
String collectionForSecondDatabase = 'flutterfire-2' ;
45
+
29
46
CollectionReference <Map <String , dynamic >> collection =
30
- firestore.collection ('$collectionForSecondDatabase /$id /query-tests' );
47
+ firestore.collection (
48
+ '$collectionForSecondDatabase /$id /${getCurrentPlatform ()}' ,
49
+ );
31
50
QuerySnapshot <Map <String , dynamic >> snapshot = await collection.get ();
32
51
33
52
await Future .forEach (snapshot.docs,
0 commit comments