fast_rx_test 0.3.2 copy "fast_rx_test: ^0.3.2" to clipboard
fast_rx_test: ^0.3.2 copied to clipboard

outdated

Testing utilities for fast_rx. Check for valid RxObject registration and notifications.

Testing utilities for fast_rx

pub package checks popularity likes pub points

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),
    RxTest(
      () => Tuple(1, 2).rx,
      (rx) => rx.run(() {
        rx.item1 = 3;
        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))),
    // ignore: invalid_use_of_protected_member
    RxTest(() => Tuple(1, 2).rx, (rx) => rx.internalSetValue(Tuple(1, 3))),
  ];

  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

0
likes
0
pub points
0%
popularity

Publisher

verified publisherrexios.dev

Testing utilities for fast_rx. Check for valid RxObject registration and notifications.

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

fast_rx, flutter, mockito, test

More

Packages that depend on fast_rx_test