forked from eatvio/eatvio_app
feat(tests): test coverage is 70.5
This commit is contained in:
@@ -3,6 +3,7 @@ import 'package:eatvio_app/core/app_initializer.dart';
|
||||
import 'package:eatvio_app/core/env_config.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
void main() {
|
||||
setUpAll(() async {
|
||||
@@ -61,5 +62,37 @@ void main() {
|
||||
expect(config.supportedLocales, isA<List>());
|
||||
expect(config.supportedLocales.isNotEmpty, true);
|
||||
});
|
||||
|
||||
test('baseUrl is initialized correctly for each build type', () {
|
||||
final prodConfig = AppConfig(buildType: AppBuildType.prod);
|
||||
final devConfig = AppConfig(buildType: AppBuildType.dev);
|
||||
final testConfig = AppConfig(buildType: AppBuildType.tests);
|
||||
|
||||
expect(prodConfig.baseUrl, isA<String>());
|
||||
expect(devConfig.baseUrl, isA<String>());
|
||||
expect(testConfig.baseUrl, isA<String>());
|
||||
expect(devConfig.baseUrl, testConfig.baseUrl);
|
||||
});
|
||||
|
||||
test('setBaseUrl can be called multiple times', () {
|
||||
final config = AppConfig(buildType: AppBuildType.prod);
|
||||
const url1 = 'https://url1.com';
|
||||
const url2 = 'https://url2.com';
|
||||
|
||||
config.setBaseUrl(url1);
|
||||
expect(config.baseUrl, url1);
|
||||
|
||||
config.setBaseUrl(url2);
|
||||
expect(config.baseUrl, url2);
|
||||
});
|
||||
|
||||
test('globalBlocProviders contains expected providers', () {
|
||||
final config = AppConfig(buildType: AppBuildType.prod);
|
||||
final providers = config.globalBlocProviders;
|
||||
|
||||
expect(providers.length, greaterThan(0));
|
||||
// Проверяем, что список содержит элементы
|
||||
expect(providers.first, isA<BlocProvider>());
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user