fix(download): recover queue after worker timeout (#524)

This commit is contained in:
zarzet
2026-08-11 17:23:29 +07:00
parent 1d363d5166
commit 95f2879110
6 changed files with 125 additions and 4 deletions
+38
View File
@@ -51,4 +51,42 @@ void main() {
);
});
});
group('native worker stop recovery', () {
test('requeues every in-flight snapshot state after the worker stops', () {
for (final status in const ['preparing', 'downloading', 'finalizing']) {
expect(
nativeWorkerStatusAfterSnapshotStop(
workerRunning: false,
status: status,
),
'queued',
);
}
});
test('preserves terminal states and live worker progress', () {
expect(
nativeWorkerStatusAfterSnapshotStop(
workerRunning: false,
status: 'completed',
),
'completed',
);
expect(
nativeWorkerStatusAfterSnapshotStop(
workerRunning: false,
status: 'failed',
),
'failed',
);
expect(
nativeWorkerStatusAfterSnapshotStop(
workerRunning: true,
status: 'downloading',
),
'downloading',
);
});
});
}