Skip to content

Commit 3a0c689

Browse files
Fix flaky cancelTasksWithIds integration test
Updated the `cancelTasksWithIds` test in `example/integration_test/general_test.dart` to use a larger file (`urlWithContentLength` instead of `workingUrl`) for the task being cancelled. This prevents the task from completing before the cancellation request is processed, resolving a race condition that caused the test to fail with `TaskStatus.complete` instead of `TaskStatus.canceled`.
1 parent d43f1ef commit 3a0c689

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

example/integration_test/general_test.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -598,6 +598,9 @@ void main() {
598598
FileDownloader().registerCallbacks(
599599
taskStatusCallback: statusCallback,
600600
taskProgressCallback: progressCallback);
601+
// download a large file, so we have time to cancel
602+
task = DownloadTask(
603+
url: urlWithContentLength, filename: defaultFilename);
601604
expect(await FileDownloader().enqueue(task), isTrue);
602605
var taskIds = await FileDownloader().allTaskIds();
603606
expect(taskIds.length, equals(1));

0 commit comments

Comments
 (0)