File tree Expand file tree Collapse file tree 1 file changed +17
-2
lines changed
packages/analytics/amplify_analytics_pinpoint/example/integration_test Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -45,7 +45,6 @@ void main() {
45
45
final streamSubscription = eventsStream.listen ((event) {
46
46
fail ('Analytics disabled but events were still sent!' );
47
47
});
48
- addTearDown (streamSubscription.cancel);
49
48
50
49
const customEventName = 'enable disable event name' ;
51
50
final customEvent = AnalyticsEvent (customEventName);
@@ -56,8 +55,24 @@ void main() {
56
55
mockLifecycleObserver.triggerOnForegroundListener ();
57
56
58
57
// Give time for events to propagate if they were sent to remote server
59
- // to ensure the failure above does not execute.
58
+ // to ensure the failure is not triggered
60
59
await Future <void >.delayed (const Duration (minutes: 1 ));
60
+
61
+ streamSubscription.cancel ();
62
+
63
+ // Ensure data sent, if sent manually
64
+ await Amplify .Analytics .flushEvents ();
65
+
66
+ await expectLater (
67
+ eventsStream,
68
+ emits (
69
+ isA <TestEvent >().having (
70
+ (e) => e.eventType,
71
+ 'eventType' ,
72
+ customEventName,
73
+ ),
74
+ ),
75
+ );
61
76
},
62
77
timeout: const Timeout (Duration (minutes: 3 )),
63
78
);
You can’t perform that action at this time.
0 commit comments