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

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

Testing utilities for fast_rx

pub package checks popularity likes pub points

Features #

Method Use-case
expectRx Check for valid rx registration and notifications

Getting started #

See fast_rx

Usage #

import 'package:fast_rx_test/fast_rx_test.dart';
import 'package:test/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 registration and notifications', () {
    expectRx(
      shouldRegister: shouldRegister,
      shouldNotRegister: shouldNotify + shouldNotNotifyOrRegister,
      shouldNotify: shouldNotify,
      shouldNotNotify: shouldRegister + shouldNotNotifyOrRegister,
    );
  });
}

Additional information #

See fast_ui for more information

0
likes
160
points
73
downloads

Publisher

verified publisherrexios.dev

Weekly Downloads

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

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

fast_rx, test

More

Packages that depend on fast_rx_test