Skip to content

Commit fc4961e

Browse files
committed
Add initial load test
1 parent fcc67f2 commit fc4961e

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

freezed_provider_value_notifier/test/app_state_test.dart

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,20 @@ void main() {
7171
});
7272
});
7373
group('TodoListController', () {
74+
test('should load todos from the repository', () async {
75+
final todos = [Todo('D')];
76+
final repository = MockRepository(todos);
77+
final model = TodoListController(todosRepository: repository);
78+
79+
expect(model.value.loading, isTrue);
80+
expect(model.value.todos, []);
81+
82+
await Future.doWhile(() => Future.value(model.value.loading));
83+
84+
expect(model.value.todos, todos);
85+
expect(model.value.loading, isFalse);
86+
87+
});
7488
test('should clear the completed todos', () async {
7589
final repository = MockRepository();
7690
final todo1 = Todo('a');

0 commit comments

Comments
 (0)