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

outdated

Testing utilities for fast_rx. Check for valid RxObject registration.

Testing utilities for fast_rx

pub package checks popularity likes pub points

Features #

Method Use-case
expectRxRegistration Check for valid registration with the RxNotifier

Getting started #

See fast_rx

Usage #

import 'package:fast_rx/fast_rx.dart';
import 'package:fast_rx_test/fast_rx_test.dart';
import 'package:flutter_test/flutter_test.dart';
import 'rx_tuple.dart';

void main() {
  test('RxObject notifications', () {
    final rx = Tuple(1, 2).rx;

    expect(
      rx.stream,
      emitsInOrder(
        [
          Tuple(1, 2),
          Tuple(2, 2),
          Tuple(2, 3),
        ],
      ),
    );

    // Notify of the initial value
    rx.notify();

    // Update the value
    rx.item1 = 2;
    // Should not notify
    rx.item2 = 2;
    rx.item2 = 3;

    // RxObject.value setter should throw if used
    expect(
      // ignore: invalid_use_of_protected_member
      () => rx.value = Tuple(0, 0),
      throwsA(isA<RxObjectValueIsReadOnly>()),
    );
  });

  test('RxObject registration', () {
    final rx = Tuple(1, 2).rx;
    expectRxRegistration(
      rx,
      shouldRegister: [
        () => rx.item1,
        () => rx.item2,
      ],
      shouldNotRegister: [
        () => rx.item1 = 3,
        () => rx.item2 = 3,
      ],
    );
  });
}

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.

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

fast_rx, flutter, mockito

More

Packages that depend on fast_rx_test