-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor:adding mock classes to test_utilities
- Loading branch information
1 parent
0abb746
commit 3b75b91
Showing
6 changed files
with
55 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,9 @@ | ||
import 'dart:io'; | ||
|
||
import 'package:collaction_app/application/user/avatar/avatar_bloc.dart'; | ||
import 'package:collaction_app/infrastructure/user/avatar_repository.dart'; | ||
import 'package:mocktail/mocktail.dart'; | ||
|
||
class MockAvatarRepo extends Mock implements AvatarRepository {} | ||
|
||
class MockAvatarFile extends Mock implements File {} | ||
import '../../test_utilities.dart'; | ||
|
||
final avatarRepo = MockAvatarRepo(); | ||
final avatarRepo2 = MockAvatarRepo(); | ||
final avatarRepo = MockAvatarRepository(); | ||
final avatarRepo2 = MockAvatarRepository(); | ||
final tAvatarBloc = AvatarBloc(avatarRepo); | ||
final tAvatarFile = MockAvatarFile(); | ||
final tUri = Uri.parse('testAvatarUploadUri'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import 'package:collaction_app/application/user/profile/profile_bloc.dart'; | ||
import 'package:dartz/dartz.dart'; | ||
import 'package:flutter_test/flutter_test.dart'; | ||
import 'package:mocktail/mocktail.dart'; | ||
|
||
import 'profile_fixtures.dart'; | ||
|
||
void main() { | ||
group('Testing Profile BLoC initial state', () { | ||
test('Testing initial state', () { | ||
expect(tProfileBloc.state, ProfileState.initial()); | ||
}); | ||
|
||
{ | ||
final tProfileRepository1 = tProfileRepository; | ||
when(() => tProfileRepository1.getUserProfile()).thenAnswer( | ||
(_) => Future.value(right(tUserProfile)), | ||
); | ||
} | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import 'package:collaction_app/application/user/profile/profile_bloc.dart'; | ||
import 'package:collaction_app/domain/profile/profile.dart'; | ||
import 'package:collaction_app/domain/profile/user_profile.dart'; | ||
import 'package:collaction_app/domain/user/user.dart'; | ||
|
||
import '../../../test_utilities.dart'; | ||
|
||
final tProfileRepository = MockProfileRepository(); | ||
final tAvatarRepository = MockAvatarRepository(); | ||
const tUser = User(id: 'tId', getIdToken: getAnonymousIdToken); | ||
const tProfile = Profile(bio: 'tBio'); | ||
const tUserProfile = UserProfile(user: tUser, profile: tProfile); | ||
final tProfileBloc = ProfileBloc(tProfileRepository, tAvatarRepository); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters