forked from eatvio/eatvio_app
87 lines
3.7 KiB
Dart
87 lines
3.7 KiB
Dart
import 'package:eatvio_app/core/app_router.dart';
|
||
import 'package:eatvio_app/features/auth/entities/auth_result_entity.dart';
|
||
import 'package:flutter/material.dart';
|
||
import 'package:flutter_test/flutter_test.dart';
|
||
import 'package:go_router/go_router.dart';
|
||
|
||
void main() {
|
||
group('AppRouter', () {
|
||
test('navigatorKey инициализирован', () {
|
||
expect(AppRouter.navigatorKey, isNotNull);
|
||
expect(AppRouter.navigatorKey, isA<GlobalKey<NavigatorState>>());
|
||
});
|
||
|
||
test('appRouter инициализирован', () {
|
||
expect(AppRouter.appRouter, isNotNull);
|
||
expect(AppRouter.appRouter, isA<GoRouter>());
|
||
});
|
||
|
||
test('appRouter инициализирован с правильной конфигурацией', () {
|
||
expect(AppRouter.appRouter.configuration, isNotNull);
|
||
});
|
||
|
||
test('appRouter имеет правильный navigatorKey', () {
|
||
expect(AppRouter.appRouter.configuration.navigatorKey, AppRouter.navigatorKey);
|
||
});
|
||
|
||
test('navigateToRegisterViaSocial - метод существует', () {
|
||
expect(AppRouter.navigateToRegisterViaSocial, isA<Function>());
|
||
});
|
||
|
||
test('navigateToRegisterViaSocial - принимает правильные параметры', () {
|
||
const authResult = AuthResultEntity(accessToken: 'test_token', refreshToken: 'refresh_token', userId: '1', clientId: 'test_client_id');
|
||
const provider = 'yandex';
|
||
|
||
expect(() => AppRouter.navigateToRegisterViaSocial(authResult: authResult, provider: provider), returnsNormally);
|
||
});
|
||
|
||
test('appRouter содержит маршруты', () {
|
||
final routes = AppRouter.appRouter.configuration.routes;
|
||
expect(routes, isNotEmpty);
|
||
});
|
||
|
||
test('appRouter имеет правильную конфигурацию', () {
|
||
expect(AppRouter.appRouter.configuration, isNotNull);
|
||
expect(AppRouter.appRouter.configuration.routes, isNotEmpty);
|
||
});
|
||
|
||
test('appRouter имеет redirect функцию', () {
|
||
expect(AppRouter.appRouter.configuration.redirect, isNotNull);
|
||
});
|
||
|
||
test('navigateToRegisterViaSocial вызывает pushNamed с правильными параметрами', () {
|
||
const authResult = AuthResultEntity(accessToken: 'test_token', refreshToken: 'refresh_token', userId: '1', clientId: 'test_client_id');
|
||
const provider = 'yandex';
|
||
|
||
expect(() => AppRouter.navigateToRegisterViaSocial(authResult: authResult, provider: provider), returnsNormally);
|
||
});
|
||
|
||
test('appRouter configuration routes содержит маршруты разных типов', () {
|
||
final routes = AppRouter.appRouter.configuration.routes;
|
||
|
||
expect(routes.length, greaterThan(0));
|
||
});
|
||
|
||
test('appRouter имеет правильную конфигурацию маршрутов', () {
|
||
expect(AppRouter.appRouter.configuration.routes, isNotEmpty);
|
||
});
|
||
|
||
test('navigateToRegisterViaSocial - создает правильный extra map', () {
|
||
const authResult = AuthResultEntity(accessToken: 'test_token', refreshToken: 'refresh_token', userId: '1', clientId: 'test_client_id');
|
||
const provider = 'yandex';
|
||
|
||
expect(() => AppRouter.navigateToRegisterViaSocial(authResult: authResult, provider: provider), returnsNormally);
|
||
});
|
||
|
||
test('appRouter содержит все типы маршрутов', () {
|
||
final routes = AppRouter.appRouter.configuration.routes;
|
||
|
||
// Проверяем, что есть маршруты разных типов
|
||
expect(routes, isNotEmpty);
|
||
|
||
// Проверяем, что есть хотя бы один маршрут
|
||
expect(routes.length, greaterThan(0));
|
||
});
|
||
});
|
||
}
|