Files
immich/mobile/test/unit/utils/isolate_worker_test.dart
T
mertalev 15f8afbd81 event-based cancellation
wire hash cancellation

await cleanup

remove forced kill

add regression tests

abort sync requests

fix cleanup ordering in teardown

exit isolate

test background sync

test sigabrt crash

cleanup
2026-05-29 19:01:47 -04:00

24 lines
667 B
Dart

import 'package:flutter_test/flutter_test.dart';
import 'package:immich_mobile/wm_executor.dart';
void main() {
tearDown(workerManagerPatch.dispose);
test('dispose() drains a cancelled task and delivers its result', () async {
await workerManagerPatch.init(isolatesCount: 1, dynamicSpawning: false);
final task = workerManagerPatch.executeGentle((onCancel) async {
await onCancel.future;
return 'drained';
});
await workerManagerPatch.dispose();
expect(
await task.timeout(const Duration(seconds: 5)),
'drained',
reason: 'the worker must finish and return its result, not be killed mid-task',
);
});
}