-
-
Notifications
You must be signed in to change notification settings - Fork 283
Expand file tree
/
Copy pathsentry_client_test.dart
More file actions
44 lines (35 loc) · 1.18 KB
/
sentry_client_test.dart
File metadata and controls
44 lines (35 loc) · 1.18 KB
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
import 'package:mockito/mockito.dart';
import 'package:sentry/sentry.dart';
import 'package:test/test.dart';
import 'mocks.dart';
void main() {
group('SentryClient sampling', () {
SentryOptions options;
Transport transport;
setUp(() {
options = SentryOptions(dsn: fakeDsn);
transport = MockTransport();
});
test('captures event, sample rate is 100% enabled', () {
options.sampleRate = 1.0;
final client = SentryClient(options);
client.options.transport = transport;
client.captureEvent(fakeEvent);
verify(client.options.transport.send(any)).called(1);
});
test('do not capture event, sample rate is 0% disabled', () {
options.sampleRate = 0.0;
final client = SentryClient(options);
client.options.transport = transport;
client.captureEvent(fakeEvent);
verifyNever(client.options.transport.send(any));
});
test('do not capture event, sample rate is null', () {
options.sampleRate = null;
final client = SentryClient(options);
client.options.transport = transport;
client.captureEvent(fakeEvent);
verifyNever(client.options.transport.send(any));
});
});
}