fix(test): capture cacheFirst stream Future before feeding controller

This commit is contained in:
2026-05-14 15:59:16 -04:00
parent e59ccba961
commit 67bacac84b
+5 -1
View File
@@ -36,7 +36,11 @@ void main() {
// (still-empty) rows after the fetch returns, so the stream
// never hangs when populate is a no-op for this filter. The
// simulated drift re-emit then yields the populated rows.
final emissions = await results.take(2).toList();
// Capture the Future *before* feeding the controller so the
// listener is subscribed when the first add() lands.
final emissionsFuture = results.take(2).toList();
controller.add([]);
final emissions = await emissionsFuture;
expect(emissions, [0, 42]);
expect(fetchCalled, 1);
await controller.close();