@@ -100,6 +100,11 @@ class TestLifecycleModule extends LifecycleModule {
100
100
];
101
101
}
102
102
103
+ // Overriding without re-applying the @protected annotation allows us to call
104
+ // activeSpan in our tests below.
105
+ @override
106
+ Span get activeSpan => super .activeSpan;
107
+
103
108
// Overriding without re-applying the @protected annotation allows us to call
104
109
// loadChildModule in our tests below.
105
110
@override
@@ -484,6 +489,11 @@ void runTests(bool runSpanTests) {
484
489
module.specifyFirstUsefulState ();
485
490
});
486
491
});
492
+
493
+ test ('activeSpan should be null when load is finished' , () async {
494
+ await module.load ();
495
+ expect (module.activeSpan, isNull);
496
+ });
487
497
}
488
498
489
499
group ('with an onLoad that throws' , () {
@@ -866,6 +876,7 @@ void runTests(bool runSpanTests) {
866
876
['willResume' , 'onResume' , 'didResume' ]
867
877
..addAll (expectedSuspendEvents));
868
878
});
879
+
869
880
test ('should emit lifecycle log events' , () async {
870
881
await gotoState (module, LifecycleState .loaded);
871
882
expect (
@@ -892,6 +903,12 @@ void runTests(bool runSpanTests) {
892
903
await module.suspend ();
893
904
});
894
905
906
+ test ('activeSpan should be null when suspend is finished' , () async {
907
+ await gotoState (module, LifecycleState .loaded);
908
+ await module.suspend ();
909
+ expect (module.activeSpan, isNull);
910
+ });
911
+
895
912
test (
896
913
'if a transition is in progress should wait to start this until that finishes' ,
897
914
() async {
@@ -1170,6 +1187,12 @@ void runTests(bool runSpanTests) {
1170
1187
await module.resume ();
1171
1188
});
1172
1189
1190
+ test ('activeSpan should be null when resume is finished' , () async {
1191
+ await gotoState (module, LifecycleState .suspended);
1192
+ await module.resume ();
1193
+ expect (module.activeSpan, isNull);
1194
+ });
1195
+
1173
1196
test (
1174
1197
'if a transition is in progress should wait to start this until that finishes' ,
1175
1198
() async {
@@ -2135,6 +2158,11 @@ void runTests(bool runSpanTests) {
2135
2158
expect (span.parentContext.spanId, parentUnloadContext.spanId);
2136
2159
expect (span.tags['custom.unload.tag' ], 'somevalue' );
2137
2160
});
2161
+
2162
+ test ('activeSpan should be null when unload is finished' , () async {
2163
+ await parentModule.unload ();
2164
+ expect (parentModule.activeSpan, isNull);
2165
+ });
2138
2166
}
2139
2167
2140
2168
test ('should emit lifecycle log events' , () async {
0 commit comments