forked from eatvio/eatvio_app
chore(version): update app version to 1.3.5+85 and improve test coverage reporting in CI
This commit is contained in:
@@ -1,74 +1,65 @@
|
||||
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:eatvio_app/core/env_config.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:flutter_dotenv/flutter_dotenv.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
|
||||
''');
|
||||
});
|
||||
setUpAll(() async {
|
||||
// Initialize dotenv for tests
|
||||
dotenv.loadFromString(envString: 'DEV_BASE_URL=http://localhost\nBASE_URL=http://localhost');
|
||||
});
|
||||
|
||||
test('создание с buildType.prod - использует baseUrl', () {
|
||||
group('AppConfig', () {
|
||||
test('creates config with prod build type', () {
|
||||
final config = AppConfig(buildType: AppBuildType.prod);
|
||||
|
||||
expect(config.buildType, AppBuildType.prod);
|
||||
expect(config.baseUrl, isNotEmpty);
|
||||
expect(config.baseUrl, EnvConfig.baseUrl);
|
||||
});
|
||||
|
||||
test('создание с buildType.dev - использует devBaseUrl', () {
|
||||
test('creates config with dev build type', () {
|
||||
final config = AppConfig(buildType: AppBuildType.dev);
|
||||
|
||||
expect(config.buildType, AppBuildType.dev);
|
||||
expect(config.baseUrl, isNotEmpty);
|
||||
expect(config.baseUrl, EnvConfig.devBaseUrl);
|
||||
});
|
||||
|
||||
test('создание с buildType.tests - использует devBaseUrl', () {
|
||||
test('creates config with tests build type', () {
|
||||
final config = AppConfig(buildType: AppBuildType.tests);
|
||||
|
||||
expect(config.buildType, AppBuildType.tests);
|
||||
expect(config.baseUrl, isNotEmpty);
|
||||
expect(config.baseUrl, EnvConfig.devBaseUrl);
|
||||
});
|
||||
|
||||
test('setBaseUrl - изменяет baseUrl', () {
|
||||
final config = AppConfig(buildType: AppBuildType.tests);
|
||||
const newUrl = 'http://test.example.com';
|
||||
test('setBaseUrl updates baseUrl', () {
|
||||
final config = AppConfig(buildType: AppBuildType.prod);
|
||||
const newUrl = 'https://new-url.com';
|
||||
|
||||
config.setBaseUrl(newUrl);
|
||||
|
||||
expect(config.baseUrl, newUrl);
|
||||
});
|
||||
|
||||
test('globalBlocProviders - возвращает список провайдеров', () {
|
||||
final config = AppConfig(buildType: AppBuildType.tests);
|
||||
test('globalBlocProviders returns list of BlocProvider', () {
|
||||
final config = AppConfig(buildType: AppBuildType.prod);
|
||||
|
||||
final providers = config.globalBlocProviders;
|
||||
|
||||
expect(providers, isNotEmpty);
|
||||
expect(providers.length, greaterThan(0));
|
||||
expect(config.globalBlocProviders, isA<List>());
|
||||
expect(config.globalBlocProviders.isNotEmpty, true);
|
||||
});
|
||||
|
||||
test('localizationDelegates - возвращает список делегатов', () {
|
||||
final config = AppConfig(buildType: AppBuildType.tests);
|
||||
test('localizationDelegates returns list of LocalizationsDelegate', () {
|
||||
final config = AppConfig(buildType: AppBuildType.prod);
|
||||
|
||||
final delegates = config.localizationDelegates;
|
||||
|
||||
expect(delegates, isNotEmpty);
|
||||
expect(delegates.length, greaterThan(0));
|
||||
expect(config.localizationDelegates, isA<List>());
|
||||
expect(config.localizationDelegates.isNotEmpty, true);
|
||||
});
|
||||
|
||||
test('supportedLocales - возвращает список локалей', () {
|
||||
final config = AppConfig(buildType: AppBuildType.tests);
|
||||
test('supportedLocales returns list of Locale', () {
|
||||
final config = AppConfig(buildType: AppBuildType.prod);
|
||||
|
||||
final locales = config.supportedLocales;
|
||||
|
||||
expect(locales, isNotEmpty);
|
||||
expect(locales.length, greaterThan(0));
|
||||
expect(config.supportedLocales, isA<List>());
|
||||
expect(config.supportedLocales.isNotEmpty, true);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user