From ed5674db9c5ec2dbe994d1c449270f373f93c675 Mon Sep 17 00:00:00 2001 From: Eric Seidel Date: Mon, 2 Feb 2026 08:23:16 -0800 Subject: [PATCH] fix: deflake throttled progress update test (#3495) --- .../test/src/artifact_manager_test.dart | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/packages/shorebird_cli/test/src/artifact_manager_test.dart b/packages/shorebird_cli/test/src/artifact_manager_test.dart index fdda28e8..1c6beec8 100644 --- a/packages/shorebird_cli/test/src/artifact_manager_test.dart +++ b/packages/shorebird_cli/test/src/artifact_manager_test.dart @@ -352,10 +352,10 @@ void main() { ), ), ); - // Download the first 3/5. The first addition will trigger the first - // progress update, the second addition will be throttled, and the - // third addition will trigger the second progress update after the - // delay. + // Download the first 3/5. The first addition will trigger the + // first progress update, the second addition will be throttled, + // and the third addition will trigger the second progress update + // after the delay. responseStreamController ..add([1]) ..add([1]) @@ -364,9 +364,14 @@ void main() { // Download the last 2/5, bringing the total to 5/5 responseStreamController.add([1, 1]); await Future.delayed(const Duration(milliseconds: 70)); + // The first update (20%) always fires immediately. The + // trailing throttled update may be 40% or 60% depending on + // timing. The final 100% always fires. verifyInOrder([ () => progress.update('hello (20%)'), - () => progress.update('hello (60%)'), + () => progress.update( + any(that: anyOf('hello (40%)', 'hello (60%)')), + ), () => progress.update('hello (100%)'), ]); verifyNever(() => progress.update('hello (0%)'));