riverpod_testing_library 0.2.0 copy "riverpod_testing_library: ^0.2.0" to clipboard
riverpod_testing_library: ^0.2.0 copied to clipboard

A testing library which makes it easy to test providers. Built to be used with the riverpod package.

example/main.dart

import 'package:riverpod_testing_library/riverpod_testing_library.dart';
import 'package:test/test.dart';

import '../test/test_utils/notifier/counter.dart';

void main() {
  group('provider_test', () {
    group('Counter NotifierProvider', () {
      providerTest<int>(
        'emits the initial state when fireImmediately is true',
        provider: counterProvider,
        fireImmediately: true,
        expect: () => [0],
      );

      providerTest<int>(
        'emits [] when nothing is done',
        provider: counterProvider,
        expect: () => [],
      );

      providerTest<int>(
        'emits [1] when Counter.increment() is called',
        provider: counterProvider,
        act: (container) =>
            container.read(counterProvider.notifier).increment(),
        expect: () => [1],
      );
    });
  });
}
3
likes
140
pub points
0%
popularity

Publisher

unverified uploader

A testing library which makes it easy to test providers. Built to be used with the riverpod package.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

diff_match_patch, meta, mocktail, riverpod, test

More

Packages that depend on riverpod_testing_library