@@ -5,6 +5,8 @@ import 'package:flutter_test/flutter_test.dart';
55import 'package:listenable_stream/listenable_stream.dart' ;
66import 'package:rxdart/rxdart.dart' ;
77
8+ // ignore_for_file: invalid_use_of_protected_member
9+
810void _isSingleSubscriptionStream (Stream <dynamic > stream) {
911 expect (stream.isBroadcast, isFalse);
1012
@@ -15,7 +17,7 @@ void _isSingleSubscriptionStream(Stream<dynamic> stream) {
1517
1618void main () {
1719 group ('ListenableToStream' , () {
18- test ('Emit self when calling `notifyListeners()`' , () {
20+ test ('Emit self when calling `notifyListeners()`' , () async {
1921 final changeNotifier = ChangeNotifier ();
2022 final stream = changeNotifier.toStream ();
2123
@@ -48,6 +50,7 @@ void main() {
4850 expectAsync1 (
4951 (e) => expect (e, changeNotifier),
5052 count: 3 ,
53+ max: 3 ,
5154 ),
5255 );
5356
@@ -60,6 +63,8 @@ void main() {
6063
6164 changeNotifier.notifyListeners ();
6265 changeNotifier.notifyListeners ();
66+
67+ assert (! changeNotifier.hasListeners);
6368 });
6469
6570 test ('Pause resume' , () async {
@@ -70,6 +75,7 @@ void main() {
7075 expectAsync1 (
7176 (v) => expect (v, changeNotifier),
7277 count: 4 ,
78+ max: 4 ,
7379 ),
7480 )..pause ();
7581
@@ -86,7 +92,7 @@ void main() {
8692 });
8793
8894 group ('ValueListenableToStream' , () {
89- test ('Emits changed value when calling `value` setter' , () {
95+ test ('Emits changed value when calling `value` setter' , () async {
9096 final valueNotifier = ValueNotifier (0 );
9197 final stream = valueNotifier.toValueStream ();
9298
@@ -102,7 +108,7 @@ void main() {
102108 });
103109
104110 test ('Replay value and emits changed value when calling `value` setter' ,
105- () {
111+ () async {
106112 final valueNotifier = ValueNotifier (0 );
107113 final stream = valueNotifier.toValueStream (replayValue: true );
108114
@@ -139,6 +145,7 @@ void main() {
139145 expectAsync1 (
140146 (e) => expect (e, i++ ),
141147 count: 3 ,
148+ max: 3 ,
142149 ),
143150 );
144151
@@ -151,6 +158,8 @@ void main() {
151158
152159 valueNotifier.value = 4 ;
153160 valueNotifier.value = 5 ;
161+
162+ assert (! valueNotifier.hasListeners);
154163 }
155164
156165 {
@@ -162,6 +171,7 @@ void main() {
162171 expectAsync1 (
163172 (e) => expect (e, i++ ),
164173 count: 4 ,
174+ max: 4 ,
165175 ),
166176 );
167177
@@ -174,6 +184,8 @@ void main() {
174184
175185 valueNotifier.value = 4 ;
176186 valueNotifier.value = 5 ;
187+
188+ assert (! valueNotifier.hasListeners);
177189 }
178190 });
179191
@@ -188,6 +200,7 @@ void main() {
188200 expectAsync1 (
189201 (v) => expect (v, expected[i++ ]),
190202 count: expected.length,
203+ max: expected.length,
191204 ),
192205 )..pause ();
193206
0 commit comments