Skip to content

Commit de02b25

Browse files
committed
more tests
1 parent 8f4288d commit de02b25

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

test/listenable_stream_test.dart

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ void main() {
104104
final stream = valueNotifier.toValueStream();
105105

106106
expect(stream.value, 0);
107+
expect(stream.valueOrNull, 0);
108+
expect(stream.hasValue, isTrue);
107109
expect(
108110
stream,
109111
emitsInOrder([1, 2, 3]),
@@ -120,6 +122,8 @@ void main() {
120122
final stream = valueNotifier.toValueStream(replayValue: true);
121123

122124
expect(stream.value, 0);
125+
expect(stream.valueOrNull, 0);
126+
expect(stream.hasValue, isTrue);
123127
expect(
124128
stream,
125129
emitsInOrder([0, 1, 2, 3]),
@@ -298,15 +302,23 @@ void main() {
298302
});
299303

300304
test('Has no error', () {
305+
final notReplay = () => ValueNotifier(0).toValueStream();
301306
expect(
302-
() => ValueNotifier(0).toValueStream().error,
307+
() => notReplay().error,
303308
throwsA(anything),
304309
);
310+
expect(notReplay().errorOrNull, isNull);
311+
expect(notReplay().stackTrace, isNull);
312+
expect(notReplay().hasError, isFalse);
305313

314+
final replay = () => ValueNotifier(0).toValueStream(replayValue: true);
306315
expect(
307-
() => ValueNotifier(0).toValueStream(replayValue: true).error,
316+
() => replay().error,
308317
throwsA(anything),
309318
);
319+
expect(replay().errorOrNull, isNull);
320+
expect(replay().stackTrace, isNull);
321+
expect(replay().hasError, isFalse);
310322
});
311323
});
312324
}

0 commit comments

Comments
 (0)