Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/flutterando/value_listenable_test
Assists in testing ValueListenable objects (ex: ValueNotifier).
https://github.com/flutterando/value_listenable_test
dart
Last synced: 3 days ago
JSON representation
Assists in testing ValueListenable objects (ex: ValueNotifier).
- Host: GitHub
- URL: https://github.com/flutterando/value_listenable_test
- Owner: Flutterando
- License: other
- Created: 2022-01-04T15:14:23.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-05-30T03:12:40.000Z (over 1 year ago)
- Last Synced: 2025-01-08T19:54:41.467Z (16 days ago)
- Topics: dart
- Language: Dart
- Homepage: https://pub.dev/packages/value_listenable_test
- Size: 4.88 KB
- Stars: 4
- Watchers: 6
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# value_listenable_test
Assists in testing **ValueListenable** objects (ex: **ValueNotifier**).
## install
Added in your `pubspec.yaml` as **dev dependency**:
```yaml
dev_dependencies:
value_listenable_test: any
```## Examples
Listen the emits of ValueListenable:
```dart
test('valueListenable Matcher', () {
final counter = ValueNotifier(0);
expect(counter, emitValues([2, 3, 5]));
counter.value = 2;
counter.value = 3;
counter.value = 5;
});
```Also, you can use the test abstraction called **valueListenableTest**:
```dart
valueListenableTest(
'Counter emits [1] when update method is called',
build: () => Counter(),
act: (notifier) => notifier.update(1),
expect: () => [1],
);
```That`s it!