resolvePending method

Future<void> resolvePending()

Completes every pending delay immediately, without advancing time.

For teardown: a test that finishes with delays outstanding would otherwise leave futures that never complete, which surfaces later as a confusing timeout in an unrelated test.

Implementation

Future<void> resolvePending() async {
  final outstanding = List<_PendingDelay>.of(_pending);
  _pending.clear();
  for (final pending in outstanding) {
    if (!pending.completer.isCompleted) pending.completer.complete();
  }
  await _drainMicrotasks();
}