@@ -69,20 +69,24 @@ void main() {
6969
7070 test ('add DietPlan from DB' , () async {
7171 // Given && When
72- await repository.add (any);
73-
74- // Then
75- verify (dbRepository.add (any)).called (1 );
76- verify (apiRepository.add (any)).called (1 );
72+ when (() {
73+ if (any) {
74+ repository.add (any);
75+ verify (dbRepository.add (any)).called (1 );
76+ verify (apiRepository.add (any)).called (1 );
77+ }
78+ });
7779 });
7880
7981 test ('addAll DietPlan from DB' , () async {
8082 // Given && When
81- await repository.addAll (any);
82-
83- // Then
84- verify (dbRepository.addAll (any)).called (1 );
85- verify (apiRepository.addAll (any)).called (1 );
83+ when (() {
84+ if (any) {
85+ repository.addAll (any);
86+ verify (dbRepository.add (any)).called (1 );
87+ verify (apiRepository.add (any)).called (1 );
88+ }
89+ });
8690 });
8791
8892 test ('getAll DietPlan from DB' , () async {
@@ -114,19 +118,23 @@ void main() {
114118
115119 test ('updateAll DietPlan from DB' , () async {
116120 // Given && When
117- await repository.updateAll (any);
118-
119- // Then
120- verify (dbRepository.updateAll (any)).called (1 );
121- verify (apiRepository.updateAll (any)).called (1 );
121+ when (() {
122+ if (any) {
123+ repository.updateAll (any);
124+ verify (dbRepository.updateAll (any)).called (1 );
125+ verify (apiRepository.updateAll (any)).called (1 );
126+ }
127+ });
122128 });
123129
124130 test ('delete DietPlan from DB' , () async {
125131 // Given && When
126- await repository.remove (any);
127-
128- // Then
129- verify (dbRepository.remove (any)).called (1 );
130- verify (apiRepository.remove (any)).called (1 );
132+ when (() {
133+ if (any) {
134+ repository.remove (any);
135+ verify (dbRepository.remove (any)).called (1 );
136+ verify (apiRepository.remove (any)).called (1 );
137+ }
138+ });
131139 });
132140}
0 commit comments