forked from eatvio/eatvio_app
feat(test): update oauth handling and improve preferences management
This commit is contained in:
74
test/core/app_config_test.dart
Normal file
74
test/core/app_config_test.dart
Normal file
@@ -0,0 +1,74 @@
|
||||
import 'package:eatvio_app/core/app_config.dart';
|
||||
import 'package:eatvio_app/core/app_initializer.dart';
|
||||
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
group('AppConfig', () {
|
||||
setUp(() async {
|
||||
// Инициализируем dotenv для тестов
|
||||
dotenv.loadFromString(envString: '''
|
||||
BASE_URL=https://api.example.com
|
||||
DEV_BASE_URL=https://dev-api.example.com
|
||||
''');
|
||||
});
|
||||
|
||||
test('создание с buildType.prod - использует baseUrl', () {
|
||||
final config = AppConfig(buildType: AppBuildType.prod);
|
||||
|
||||
expect(config.buildType, AppBuildType.prod);
|
||||
expect(config.baseUrl, isNotEmpty);
|
||||
});
|
||||
|
||||
test('создание с buildType.dev - использует devBaseUrl', () {
|
||||
final config = AppConfig(buildType: AppBuildType.dev);
|
||||
|
||||
expect(config.buildType, AppBuildType.dev);
|
||||
expect(config.baseUrl, isNotEmpty);
|
||||
});
|
||||
|
||||
test('создание с buildType.tests - использует devBaseUrl', () {
|
||||
final config = AppConfig(buildType: AppBuildType.tests);
|
||||
|
||||
expect(config.buildType, AppBuildType.tests);
|
||||
expect(config.baseUrl, isNotEmpty);
|
||||
});
|
||||
|
||||
test('setBaseUrl - изменяет baseUrl', () {
|
||||
final config = AppConfig(buildType: AppBuildType.tests);
|
||||
const newUrl = 'http://test.example.com';
|
||||
|
||||
config.setBaseUrl(newUrl);
|
||||
|
||||
expect(config.baseUrl, newUrl);
|
||||
});
|
||||
|
||||
test('globalBlocProviders - возвращает список провайдеров', () {
|
||||
final config = AppConfig(buildType: AppBuildType.tests);
|
||||
|
||||
final providers = config.globalBlocProviders;
|
||||
|
||||
expect(providers, isNotEmpty);
|
||||
expect(providers.length, greaterThan(0));
|
||||
});
|
||||
|
||||
test('localizationDelegates - возвращает список делегатов', () {
|
||||
final config = AppConfig(buildType: AppBuildType.tests);
|
||||
|
||||
final delegates = config.localizationDelegates;
|
||||
|
||||
expect(delegates, isNotEmpty);
|
||||
expect(delegates.length, greaterThan(0));
|
||||
});
|
||||
|
||||
test('supportedLocales - возвращает список локалей', () {
|
||||
final config = AppConfig(buildType: AppBuildType.tests);
|
||||
|
||||
final locales = config.supportedLocales;
|
||||
|
||||
expect(locales, isNotEmpty);
|
||||
expect(locales.length, greaterThan(0));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user