triple_test

Creator: coderz1093

Last updated:

0 purchases

triple_test Image
triple_test Images

Languages

Categories

Add to Cart

Description:

triple test

triple_test #
Test Helper for Store of flutter_triple with Mocktail.
** Inspired by bloc_test **
Create a Mock #
import 'package:bloc_test/bloc_test.dart';

class MockCounterStore extends MockStore<Exception, int> implements CounterStore {}

...

final mock = MockCounterStore();

copied to clipboard
Now creates a stud for the method on Triple Store.
whenObserve<MyException, int>(
mock,
input: () => mock.testAdd(),
initialState: 0,
triples: [
Triple(state: 1),
Triple(isLoading: true, event: TripleEvent.loading, state: 1),
Triple(state: 2),
],
);
copied to clipboard

NOTE: You can use Triple Matchers: tripleState, tripleLoading e tripleError;

Testing Stores #
The flutter_test gives us the test() function to describe what will be tested in a prepared scope. triple_test makes it easier to test Triple Stores using the storeTest() function instead of test();
storeTest<TestImplementsMock>(
'Testing triple',
build: () => MyStore(),
act: (store) => store.testAdd(),
expect: () => [tripleLoading, 1],
);
copied to clipboard

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.