/
firebase_app_check_e2e.dart
64 lines (57 loc) 路 1.88 KB
/
firebase_app_check_e2e.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// Copyright 2022, the Chromium project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:drive/drive.dart';
import 'package:firebase_app_check/firebase_app_check.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/foundation.dart';
import '../firebase_default_options.dart';
void setupTests() {
group(
'firebase_app_check',
() {
setUpAll(() async {
await Firebase.initializeApp(
options: DefaultFirebaseOptions.currentPlatform,
);
});
test('activate', () async {
await expectLater(
FirebaseAppCheck.instance.activate(
webRecaptchaSiteKey: '6Lemcn0dAAAAABLkf6aiiHvpGD6x-zF3nOSDU2M8',
androidDebugProvider: true,
),
completes,
);
});
test(
'getToken',
() async {
final token = await FirebaseAppCheck.instance.getToken(true);
expect(token, isA<String>());
},
// Getting "Fetch server returned an HTTP error status. HTTP status:
// 400" when running tests on web.
//
// Is not working on iOS and macOS. Tracking issue:
// https://github.com/firebase/flutterfire/issues/8969
skip: kIsWeb ||
defaultTargetPlatform == TargetPlatform.iOS ||
defaultTargetPlatform == TargetPlatform.macOS,
);
test(
'setTokenAutoRefreshEnabled',
() async {
await expectLater(
FirebaseAppCheck.instance.setTokenAutoRefreshEnabled(true),
completes,
);
},
);
test('onTokenChange', () async {
final stream = FirebaseAppCheck.instance.onTokenChange;
expect(stream, isA<Stream<String?>>());
});
},
);
}