add tests for .then with a nullable T (#128)
diff --git a/test/cancelable_operation_test.dart b/test/cancelable_operation_test.dart
index c87e43a..0e8d8d4 100644
--- a/test/cancelable_operation_test.dart
+++ b/test/cancelable_operation_test.dart
@@ -23,6 +23,13 @@
expect(completer.isCompleted, isTrue);
});
+ test('sends null values to the future', () {
+ expect(completer.operation.value, completion(equals(null)));
+ expect(completer.isCompleted, isFalse);
+ completer.complete(null);
+ expect(completer.isCompleted, isTrue);
+ });
+
test('sends errors to the future', () {
expect(completer.operation.value, throwsA('error'));
expect(completer.isCompleted, isFalse);
@@ -56,6 +63,11 @@
completer.completeError('error');
});
+ test('chains null values through .then calls', () async {
+ var operation = CancelableOperation.fromFuture(Future.value(null));
+ expect(await operation.then((_) {}).value, null);
+ });
+
group('throws a StateError if completed', () {
test('successfully twice', () {
completer.complete(1);