forked from eatvio/eatvio_app
feat: test profile model
This commit is contained in:
33
test/profile_service_test.dart
Normal file
33
test/profile_service_test.dart
Normal file
@@ -0,0 +1,33 @@
|
||||
import 'package:eatvio_app/features/profile/models/profile_model.dart';
|
||||
import 'package:eatvio_app/features/profile/services/profile_service.dart';
|
||||
import 'package:mockito/annotations.dart';
|
||||
import 'package:mockito/mockito.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import 'profile_service_test.mocks.dart';
|
||||
|
||||
@GenerateNiceMocks([MockSpec<ProfileService>()])
|
||||
void main() {
|
||||
group('fetchProfile', () {
|
||||
final mockProfileService = MockProfileService();
|
||||
|
||||
test('getMyProfile', () async {
|
||||
when(mockProfileService.getMyProfile()).thenAnswer(
|
||||
(_) async => ProfileModel(
|
||||
id: 0,
|
||||
name: 'Alexander Avanesyan',
|
||||
email: 'mso7nueh@mail.ru',
|
||||
isPublicProfile: true,
|
||||
isEntitySubscribedByMe: false,
|
||||
slug: 'slug',
|
||||
profilePhotoUrl: '',
|
||||
role: 'user',
|
||||
badges: [],
|
||||
subscriptions: [],
|
||||
subscribers: [],
|
||||
),
|
||||
);
|
||||
expect(await mockProfileService.getMyProfile(), isA<ProfileModel>());
|
||||
});
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user