1
1
@TestOn ('vm' )
2
2
3
3
import 'package:flutter_test/flutter_test.dart' ;
4
+ import 'package:mockito/mockito.dart' ;
4
5
import 'package:sentry_flutter/sentry_flutter.dart' ;
5
6
import 'package:sentry_flutter/src/integrations/native_app_start_integration.dart' ;
6
7
import 'package:sentry_flutter/src/sentry_native.dart' ;
@@ -25,7 +26,7 @@ void main() {
25
26
fixture.native .appStartEnd = DateTime .fromMillisecondsSinceEpoch (10 );
26
27
fixture.wrapper.nativeAppStart = NativeAppStart (0 , true );
27
28
28
- fixture.getNativeAppStartIntegration ().call (MockHub () , fixture.options);
29
+ fixture.getNativeAppStartIntegration ().call (fixture.hub , fixture.options);
29
30
30
31
final tracer = fixture.createTracer ();
31
32
final transaction = SentryTransaction (tracer);
@@ -44,7 +45,7 @@ void main() {
44
45
fixture.native .appStartEnd = DateTime .fromMillisecondsSinceEpoch (10 );
45
46
fixture.wrapper.nativeAppStart = NativeAppStart (0 , true );
46
47
47
- fixture.getNativeAppStartIntegration ().call (MockHub () , fixture.options);
48
+ fixture.getNativeAppStartIntegration ().call (fixture.hub , fixture.options);
48
49
49
50
final tracer = fixture.createTracer ();
50
51
final transaction = SentryTransaction (tracer);
@@ -63,7 +64,7 @@ void main() {
63
64
fixture.wrapper.nativeAppStart = NativeAppStart (0 , true );
64
65
final measurement = SentryMeasurement .warmAppStart (Duration (seconds: 1 ));
65
66
66
- fixture.getNativeAppStartIntegration ().call (MockHub () , fixture.options);
67
+ fixture.getNativeAppStartIntegration ().call (fixture.hub , fixture.options);
67
68
68
69
final tracer = fixture.createTracer ();
69
70
final transaction = SentryTransaction (tracer).copyWith ();
@@ -83,7 +84,7 @@ void main() {
83
84
fixture.native .appStartEnd = DateTime .fromMillisecondsSinceEpoch (60001 );
84
85
fixture.wrapper.nativeAppStart = NativeAppStart (0 , true );
85
86
86
- fixture.getNativeAppStartIntegration ().call (MockHub () , fixture.options);
87
+ fixture.getNativeAppStartIntegration ().call (fixture.hub , fixture.options);
87
88
88
89
final tracer = fixture.createTracer ();
89
90
final transaction = SentryTransaction (tracer);
@@ -97,13 +98,15 @@ void main() {
97
98
}
98
99
99
100
class Fixture {
101
+ final hub = MockHub ();
100
102
final options = SentryFlutterOptions (dsn: fakeDsn);
101
103
final wrapper = MockNativeChannel ();
102
104
late final native = SentryNative ();
103
105
104
106
Fixture () {
105
107
native .setNativeChannel (wrapper);
106
108
native .reset ();
109
+ when (hub.options).thenReturn (options);
107
110
}
108
111
109
112
NativeAppStartIntegration getNativeAppStartIntegration () {
@@ -124,6 +127,6 @@ class Fixture {
124
127
'op' ,
125
128
samplingDecision: SentryTracesSamplingDecision (sampled! ),
126
129
);
127
- return SentryTracer (context, MockHub () );
130
+ return SentryTracer (context, hub );
128
131
}
129
132
}
0 commit comments