Skip to content

Commit 3d61342

Browse files
committed
Use expectLater instead
1 parent a18a7c7 commit 3d61342

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

dwds/test/hot_reload_breakpoints_test.dart

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,9 @@ void main() {
177177
List<({String file, String breakpointMarker, Breakpoint? bp})>
178178
breakpoints,
179179
) async {
180-
final waitForPausePost = stream.firstWhere(
181-
(event) => event.kind == EventKind.kPausePostRequest,
180+
final waitForPausePost = expectLater(
181+
stream,
182+
emitsThrough(_hasKind(EventKind.kPausePostRequest)),
182183
);
183184

184185
// Initiate the hot reload by loading the sources into the page.
@@ -235,8 +236,8 @@ void main() {
235236
});
236237
}
237238

238-
Future<Event> waitForBreakpoint() =>
239-
stream.firstWhere((event) => event.kind == EventKind.kPauseBreakpoint);
239+
Future<dynamic> waitForBreakpoint() =>
240+
expectLater(stream, emitsThrough(_hasKind(EventKind.kPauseBreakpoint)));
240241

241242
test('after edit and hot reload, breakpoint is in new file', () async {
242243
final oldString = 'main gen0';
@@ -501,3 +502,6 @@ void main() {
501502
});
502503
}, timeout: Timeout.factor(2));
503504
}
505+
506+
TypeMatcher<Event> _hasKind(String kind) =>
507+
isA<Event>().having((e) => e.kind, 'kind', kind);

0 commit comments

Comments
 (0)