From e38189470b1e0eacec6475e0a5b4480d394f958e Mon Sep 17 00:00:00 2001 From: Bryan Van Deusen Date: Thu, 14 May 2026 15:41:00 -0400 Subject: [PATCH] test(cache_first): update test for new yield-after-fetch semantics The cacheFirst fix in 5511f87 added a yield after fetchAndPopulate so streams never hang when populate is a no-op for this filter (the liked-tab spinner-forever bug). Test expectation updated: the first emission after an empty drift is now the still-empty yield ("we tried, nothing to show yet"), and the simulated drift re-emit yields the populated rows as the second emission. --- flutter_client/test/cache/cache_first_test.dart | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/flutter_client/test/cache/cache_first_test.dart b/flutter_client/test/cache/cache_first_test.dart index f98f7db9..9f99e2be 100644 --- a/flutter_client/test/cache/cache_first_test.dart +++ b/flutter_client/test/cache/cache_first_test.dart @@ -32,9 +32,12 @@ void main() { isOnline: () async => true, ); - final firstFuture = results.first; - controller.add([]); - expect(await firstFuture, 42); + // Post-coldFetchAttempted guard, cacheFirst yields the current + // (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(); + expect(emissions, [0, 42]); expect(fetchCalled, 1); await controller.close(); });