-
Notifications
You must be signed in to change notification settings - Fork 3.9k
/
platform_interface_recaptcha_verifier_factory_test.dart
127 lines (113 loc) 路 3.92 KB
/
platform_interface_recaptcha_verifier_factory_test.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
// ignore_for_file: require_trailing_commas
// Copyright 2020, 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:firebase_auth_platform_interface/firebase_auth_platform_interface.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:plugin_platform_interface/plugin_platform_interface.dart';
void main() {
group('$RecaptchaVerifierFactoryPlatform()', () {
late TestRecaptchaVerifierFactoryPlatform recaptchaVerifierFactoryPlatform;
setUpAll(() async {
recaptchaVerifierFactoryPlatform = TestRecaptchaVerifierFactoryPlatform();
});
test('Constructor', () {
expect(recaptchaVerifierFactoryPlatform,
isA<RecaptchaVerifierFactoryPlatform>());
expect(recaptchaVerifierFactoryPlatform, isA<PlatformInterface>());
});
group('set.instance', () {
test('sets current instance', () {
try {
RecaptchaVerifierFactoryPlatform.instance =
recaptchaVerifierFactoryPlatform;
} catch (_) {
fail('thrown an unexpected error');
}
});
});
test('get.instance', () {
try {
RecaptchaVerifierFactoryPlatform.instance =
recaptchaVerifierFactoryPlatform;
final result = RecaptchaVerifierFactoryPlatform.instance;
expect(result, isA<RecaptchaVerifierFactoryPlatform>());
} catch (_) {
fail('thrown an unexpected error');
}
});
group('verify()', () {
test('calls successfully', () {
try {
RecaptchaVerifierFactoryPlatform.verifyExtends(
recaptchaVerifierFactoryPlatform);
return;
} catch (_) {
fail('thrown an unexpected exception');
}
});
});
test('throws if delegate', () async {
try {
await recaptchaVerifierFactoryPlatform.delegate;
} on UnimplementedError catch (e) {
expect(e.message, equals('delegate is not implemented'));
return;
}
fail('Should have thrown an [UnimplementedError]');
});
group('delegateFor()', () {
test('throws UnimplementedError error', () async {
try {
recaptchaVerifierFactoryPlatform.delegateFor(
auth: FirebaseAuthPlatform.instance,
);
} on UnimplementedError catch (e) {
expect(e.message, equals('delegateFor() is not implemented'));
return;
}
fail('Should have thrown an [UnimplementedError]');
});
});
test('throws if type', () async {
try {
recaptchaVerifierFactoryPlatform.type;
} on UnimplementedError catch (e) {
expect(e.message, equals('type is not implemented'));
return;
}
fail('Should have thrown an [UnimplementedError]');
});
test('throws if clear()', () async {
try {
recaptchaVerifierFactoryPlatform.clear();
} on UnimplementedError catch (e) {
expect(e.message, equals('clear() is not implemented'));
return;
}
fail('Should have thrown an [UnimplementedError]');
});
test('throws if render()', () async {
try {
await recaptchaVerifierFactoryPlatform.render();
} on UnimplementedError catch (e) {
expect(e.message, equals('render() is not implemented'));
return;
}
fail('Should have thrown an [UnimplementedError]');
});
test('throws if verify()', () async {
try {
await recaptchaVerifierFactoryPlatform.verify();
} on UnimplementedError catch (e) {
expect(e.message, equals('verify() is not implemented'));
return;
}
fail('Should have thrown an [UnimplementedError]');
});
});
}
class TestRecaptchaVerifierFactoryPlatform
extends RecaptchaVerifierFactoryPlatform {
TestRecaptchaVerifierFactoryPlatform() : super();
}