forked from eatvio/eatvio_app
test(session): cover avatar refresh and session teardown
Add regression tests for avatar reset and token-change refresh, stale 401 handling, idempotent session teardown and account-scoped preference cleanup. Update existing cubit tests for the new session dependency. Refs: #1113
This commit is contained in:
@@ -4,6 +4,8 @@ import 'package:eatvio_app/features/profile/repositories/profile_repository.dart
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:mockito/annotations.dart';
|
||||
import 'package:mockito/mockito.dart';
|
||||
|
||||
import '../../../../fixtures/doubles/session_doubles.dart';
|
||||
import 'menu_cubit_test.mocks.dart';
|
||||
|
||||
@GenerateNiceMocks([MockSpec<ProfileRepository>()])
|
||||
@@ -25,12 +27,12 @@ void main() {
|
||||
});
|
||||
|
||||
test('начальное состояние - MenuState', () {
|
||||
menuCubit = MenuCubit(mockProfileRepository);
|
||||
menuCubit = MenuCubit(mockProfileRepository, FakeSessionLifecycleService());
|
||||
expect(menuCubit!.state, isA<MenuState>());
|
||||
});
|
||||
|
||||
test('makePassKey - успешно создает passKey', () async {
|
||||
menuCubit = MenuCubit(mockProfileRepository);
|
||||
menuCubit = MenuCubit(mockProfileRepository, FakeSessionLifecycleService());
|
||||
const expectedPassKey = 'test-pass-key';
|
||||
|
||||
when(mockProfileRepository.getPassKey(
|
||||
@@ -48,7 +50,7 @@ void main() {
|
||||
});
|
||||
|
||||
test('makePassKey - возвращает null при ошибке', () async {
|
||||
menuCubit = MenuCubit(mockProfileRepository);
|
||||
menuCubit = MenuCubit(mockProfileRepository, FakeSessionLifecycleService());
|
||||
|
||||
when(mockProfileRepository.getPassKey(
|
||||
routeName: 'product_nutritional_value.index',
|
||||
|
||||
Reference in New Issue
Block a user