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() {
4545 final streamSubscription = eventsStream.listen ((event) {
4646 fail ('Analytics disabled but events were still sent!' );
4747 });
48- addTearDown (streamSubscription.cancel);
4948
5049 const customEventName = 'enable disable event name' ;
5150 final customEvent = AnalyticsEvent (customEventName);
@@ -56,8 +55,24 @@ void main() {
5655 mockLifecycleObserver.triggerOnForegroundListener ();
5756
5857 // 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
6059 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+ );
6176 },
6277 timeout: const Timeout (Duration (minutes: 3 )),
6378 );
You can’t perform that action at this time.
0 commit comments