forked from eatvio/eatvio_app
34 lines
1.0 KiB
Dart
34 lines
1.0 KiB
Dart
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>());
|
|
});
|
|
});
|
|
}
|