fast_rx_test 0.2.0 fast_rx_test: ^0.2.0 copied to clipboard
Testing utilities for fast_rx. Check for valid RxObject registration and notifications.
Testing utilities for fast_rx
Features #
Method | Use-case |
---|---|
expectRxNotification | Check for valid rx stream notifications |
expectRxRegistration | Check for valid registration with the RxNotifier |
Getting started #
See fast_rx
Usage #
import 'package:fast_rx_test/fast_rx_test.dart';
import 'package:flutter_test/flutter_test.dart';
import 'rx_tuple.dart';
void main() {
final shouldNotify = <RxTest<RxTuple<int, int>>>[
RxTest(Tuple(1, 2).rx, (rx) => rx.item1 = 3),
RxTest(Tuple(1, 2).rx, (rx) => rx.item2 = 3),
];
final shouldRegister = <RxTest<RxTuple<int, int>>>[
RxTest(Tuple(1, 2).rx, (rx) => rx.item1),
RxTest(Tuple(1, 2).rx, (rx) => rx.item2),
];
final shouldNotNotifyOrRegister = <RxTest<RxTuple<int, int>>>[
RxTest(Tuple(1, 2).rx, (rx) => rx.copyValue()),
RxTest(Tuple(1, 2).rx, (rx) => rx.shouldNotify(Tuple(2, 2))),
];
test('RxObject notifications', () {
expectRxNotification(
shouldNotify: shouldNotify,
shouldNotNotify: shouldRegister + shouldNotNotifyOrRegister,
);
});
test('RxObject registration', () {
expectRxRegistration(
shouldRegister: shouldRegister,
shouldNotRegister: shouldNotify + shouldNotNotifyOrRegister,
);
});
}
Additional information #
See fast_ui for more information