Skip to content

Commit

Permalink
Update test to not assume completion happens synchronously. (dart-arc…
Browse files Browse the repository at this point in the history
  • Loading branch information
lrhn authored Mar 9, 2022
1 parent a58f0e7 commit 48da943
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pkgs/async/test/cancelable_operation_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -421,12 +421,12 @@ void main() {
});

group('original operation canceled', () {
test('onCancel not set', () {
test('onCancel not set', () async {
onCancel = null;

final operation = runThen();

expect(originalCompleter.operation.cancel(), completes);
await expectLater(originalCompleter.operation.cancel(), completes);
expect(operation.isCanceled, true);
});

Expand Down Expand Up @@ -460,8 +460,10 @@ void main() {
var operation = runThen();
var workCompleter = Completer<int>();
originalCompleter.complete(workCompleter.future);
originalCompleter.operation.cancel();
var cancelation = originalCompleter.operation.cancel();
expect(originalCompleter.isCanceled, true);
workCompleter.complete(0);
await cancelation;
expect(operation.isCanceled, true);
await workCompleter.future;
});
Expand Down

0 comments on commit 48da943

Please sign in to comment.