forked from eatvio/eatvio_app
66 lines
2.1 KiB
Dart
66 lines
2.1 KiB
Dart
import 'package:eatvio_app/core/app_config.dart';
|
|
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';
|
|
|
|
void main() {
|
|
setUpAll(() async {
|
|
// Initialize dotenv for tests
|
|
dotenv.loadFromString(envString: 'DEV_BASE_URL=http://localhost\nBASE_URL=http://localhost');
|
|
});
|
|
|
|
group('AppConfig', () {
|
|
test('creates config with prod build type', () {
|
|
final config = AppConfig(buildType: AppBuildType.prod);
|
|
|
|
expect(config.buildType, AppBuildType.prod);
|
|
expect(config.baseUrl, EnvConfig.baseUrl);
|
|
});
|
|
|
|
test('creates config with dev build type', () {
|
|
final config = AppConfig(buildType: AppBuildType.dev);
|
|
|
|
expect(config.buildType, AppBuildType.dev);
|
|
expect(config.baseUrl, EnvConfig.devBaseUrl);
|
|
});
|
|
|
|
test('creates config with tests build type', () {
|
|
final config = AppConfig(buildType: AppBuildType.tests);
|
|
|
|
expect(config.buildType, AppBuildType.tests);
|
|
expect(config.baseUrl, EnvConfig.devBaseUrl);
|
|
});
|
|
|
|
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 returns list of BlocProvider', () {
|
|
final config = AppConfig(buildType: AppBuildType.prod);
|
|
|
|
expect(config.globalBlocProviders, isA<List>());
|
|
expect(config.globalBlocProviders.isNotEmpty, true);
|
|
});
|
|
|
|
test('localizationDelegates returns list of LocalizationsDelegate', () {
|
|
final config = AppConfig(buildType: AppBuildType.prod);
|
|
|
|
expect(config.localizationDelegates, isA<List>());
|
|
expect(config.localizationDelegates.isNotEmpty, true);
|
|
});
|
|
|
|
test('supportedLocales returns list of Locale', () {
|
|
final config = AppConfig(buildType: AppBuildType.prod);
|
|
|
|
expect(config.supportedLocales, isA<List>());
|
|
expect(config.supportedLocales.isNotEmpty, true);
|
|
});
|
|
});
|
|
}
|